github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/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      dockerd --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  Docker fetches the values for zone, instance name and instance id from Google
    41  Cloud metadata server. Those values can be provided via options if metadata
    42  server is not available. They will not override the values from metadata server.
    43  
    44  ## gcplogs options
    45  
    46  You can use the `--log-opt NAME=VALUE` flag to specify these additional Google
    47  Cloud Logging driver options:
    48  
    49  | Option                      | Required | Description                                                                                                                                 |
    50  |-----------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------|
    51  | `gcp-project`               | optional | Which GCP project to log to. Defaults to discovering this value from the GCE metadata service.                                              |
    52  | `gcp-log-cmd`               | optional | Whether to log the command that the container was started with. Defaults to false.                                                          |
    53  | `labels`                    | optional | Comma-separated list of keys of labels, which should be included in message, if these labels are specified for container.                   |
    54  | `env`                       | optional | Comma-separated list of keys of environment variables, which should be included in message, if these variables are specified for container. |
    55  | `gcp-meta-zone`             | optional | Zone name for the instance. |
    56  | `gcp-meta-name`             | optional | Instance name. |
    57  | `gcp-meta-id`               | optional | Instance ID. |
    58  
    59  If there is collision between `label` and `env` keys, the value of the `env`
    60  takes precedence. Both options add additional fields to the attributes of a
    61  logging message.
    62  
    63  Below is an example of the logging options required to log to the default
    64  logging destination which is discovered by querying the GCE metadata server.
    65  
    66      docker run --log-driver=gcplogs \
    67          --log-opt labels=location \
    68          --log-opt env=TEST \
    69          --log-opt gcp-log-cmd=true \
    70          --env "TEST=false" \
    71          --label location=west \
    72          your/application
    73  
    74  This configuration also directs the driver to include in the payload the label
    75  `location`, the environment variable `ENV`, and the command used to start the
    76  container.
    77  
    78  An example of the logging options for running outside of GCE (the daemon must be
    79  configured with GOOGLE_APPLICATION_CREDENTIALS):
    80  
    81      docker run --log-driver=gcplogs \
    82          --log-opt gcp-project=test-project
    83          --log-opt gcp-meta-zone=west1 \
    84          --log-opt gcp-meta-name=`hostname` \
    85          your/application