0

I am trying to use Google Cloud Logging API to write log entries from a web application I'm developing (happens to be .net).

To do this, I must use the logging.projects.logs.entries.write request. This request dictates that I provide a serviceName argument:

{
  "entries": [
  {
    "textPayload": "test",
    "metadata": 
    {
      "serviceName": "compute.googleapis.com"
      "projectId": "...",
      "region": "us-central1",
      "zone": "us-central1-a",
      "severity": "DEFAULT",
      "timestamp": "2015-01-13T19:17:01Z",
      "userId": "",
    }
  }]
}

Unless I specify "compute.googleapis.com" as the serviceName I get an error 400 response:

{
  "error": 
  {
    "code": 400,
    "message": "Unsupported service specified",
    "status": "INVALID_ARGUMENT"
  }
}

For now using "compute.googleapis.com" seems to work but I'm asking - what service name should I give, given that I'm not using Google Compute Engine or Google App Engine here?

urig
  • 16,016
  • 26
  • 115
  • 184

1 Answers1

3

The Cloud Logging API currently only officially supports Google resources, so the best course of action is to continue to use "compute.googleapis.com" as the service and supply the labels "compute.googleapis.com/resource_type" and "compute.googleapis.com/resource_id", which are used for indexing and visible in the UI drop-downs.

We also currently permit the service name "custom.googleapis.com" with index labels "custom.googleapis.com/primary_key" and "custom.googleapis.com/secondary_key" but that is not officially supported and subject to change in a future release.

salty
  • 86
  • 8