github.com/portworx/docker@v1.12.1/docs/admin/logging/gcplogs.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Google Cloud Logging driver"
     4  description = "Describes how to use the Google Cloud Logging driver."
     5  keywords = ["gcplogs, google, docker, logging, driver"]
     6  [menu.main]
     7  parent = "smn_logging"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # Google Cloud Logging driver
    12  
    13  The Google Cloud Logging driver sends container logs to <a href="https://cloud.google.com/logging/docs/" target="_blank">Google Cloud
    14  Logging</a>.
    15  
    16  ## Usage
    17  
    18  You can configure the default logging driver by passing the `--log-driver`
    19  option to the Docker daemon:
    20  
    21      docker daemon --log-driver=gcplogs
    22  
    23  You can set the logging driver for a specific container by using the
    24  `--log-driver` option to `docker run`:
    25  
    26      docker run --log-driver=gcplogs ...
    27  
    28  This log driver does not implement a reader so it is incompatible with
    29  `docker logs`.
    30  
    31  If Docker detects that it is running in a Google Cloud Project, it will discover configuration
    32  from the <a href="https://cloud.google.com/compute/docs/metadata" target="_blank">instance metadata service</a>.
    33  Otherwise, the user must specify which project to log to using the `--gcp-project`
    34  log option and Docker will attempt to obtain credentials from the
    35  <a href="https://developers.google.com/identity/protocols/application-default-credentials" target="_blank">Google Application Default Credential</a>.
    36  The `--gcp-project` takes precedence over information discovered from the metadata server
    37  so a Docker daemon running in a Google Cloud Project can be overridden to log to a different
    38  Google Cloud Project using `--gcp-project`.
    39  
    40  ## gcplogs options
    41  
    42  You can use the `--log-opt NAME=VALUE` flag to specify these additional Google
    43  Cloud Logging driver options:
    44  
    45  | Option                      | Required | Description                                                                                                                                 |
    46  |-----------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------|
    47  | `gcp-project`               | optional | Which GCP project to log to. Defaults to discovering this value from the GCE metadata service.                                              |
    48  | `gcp-log-cmd`               | optional | Whether to log the command that the container was started with. Defaults to false.                                                          |
    49  | `labels`                    | optional | Comma-separated list of keys of labels, which should be included in message, if these labels are specified for container.                   |
    50  | `env`                       | optional | Comma-separated list of keys of environment variables, which should be included in message, if these variables are specified for container. |
    51  
    52  If there is collision between `label` and `env` keys, the value of the `env`
    53  takes precedence. Both options add additional fields to the attributes of a
    54  logging message.
    55  
    56  Below is an example of the logging options required to log to the default
    57  logging destination which is discovered by querying the GCE metadata server.
    58  
    59      docker run --log-driver=gcplogs \
    60          --log-opt labels=location
    61          --log-opt env=TEST
    62          --log-opt gcp-log-cmd=true
    63          --env "TEST=false"
    64          --label location=west
    65          your/application
    66  
    67  This configuration also directs the driver to include in the payload the label
    68  `location`, the environment variable `ENV`, and the command used to start the
    69  container.