github.com/mheon/docker@v0.11.2-0.20150922122814-44f47903a831/docs/reference/logging/overview.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Configuring Logging Drivers"
     4  description = "Configure logging driver."
     5  keywords = ["docker, logging, driver, Fluentd"]
     6  [menu.main]
     7  parent = "smn_logging"
     8  weight=-1
     9  +++
    10  <![end-metadata]-->
    11  
    12  
    13  # Configure logging drivers
    14  
    15  The container can have a different logging driver than the Docker daemon. Use
    16  the `--log-driver=VALUE` with the `docker run` command to configure the
    17  container's logging driver. The following options are supported:
    18  
    19  | `none`      | Disables any logging for the container. `docker logs` won't be available with this driver.                                    |
    20  |-------------|-------------------------------------------------------------------------------------------------------------------------------|
    21  | `json-file` | Default logging driver for Docker. Writes JSON messages to file.                                                              |
    22  | `syslog`    | Syslog logging driver for Docker. Writes log messages to syslog.                                                              |
    23  | `journald`  | Journald logging driver for Docker. Writes log messages to `journald`.                                                        |
    24  | `gelf`      | Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. |
    25  | `fluentd`   | Fluentd logging driver for Docker. Writes log messages to `fluentd` (forward input).                                          |
    26  | `awslogs`   | Amazon CloudWatch Logs logging driver for Docker. Writes log messages to Amazon CloudWatch Logs.                              |
    27  
    28  The `docker logs`command is available only for the `json-file` logging driver.
    29  
    30  ## json-file options
    31  
    32  The following logging options are supported for the `json-file` logging driver:
    33  
    34      --log-opt max-size=[0-9+][k|m|g]
    35      --log-opt max-file=[0-9+]
    36  
    37  Logs that reach `max-size` are rolled over. You can set the size in kilobytes(k), megabytes(m), or gigabytes(g). eg `--log-opt max-size=50m`. If `max-size` is not set, then logs are not rolled over.
    38  
    39  
    40  `max-file` specifies the maximum number of files that a log is rolled over before being discarded. eg `--log-opt max-file=100`. If `max-size` is not set, then `max-file` is not honored.
    41  
    42  If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file.
    43  
    44  ## syslog options
    45  
    46  The following logging options are supported for the `syslog` logging driver:
    47  
    48      --log-opt syslog-address=[tcp|udp]://host:port
    49      --log-opt syslog-address=unix://path
    50      --log-opt syslog-facility=daemon
    51      --log-opt tag="mailer"
    52  
    53  `syslog-address` specifies the remote syslog server address where the driver connects to.
    54  If not specified it defaults to the local unix socket of the running system.
    55  If transport is either `tcp` or `udp` and `port` is not specified it defaults to `514`
    56  The following example shows how to have the `syslog` driver connect to a `syslog`
    57  remote server at `192.168.0.42` on port `123`
    58  
    59      $ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123
    60  
    61  The `syslog-facility` option configures the syslog facility. By default, the system uses the
    62  `daemon` value. To override this behavior, you can provide an integer of 0 to 23 or any of
    63  the following named facilities:
    64  
    65  * `kern`
    66  * `user`
    67  * `mail`
    68  * `daemon`
    69  * `auth`
    70  * `syslog`
    71  * `lpr`
    72  * `news`
    73  * `uucp`
    74  * `cron`
    75  * `authpriv`
    76  * `ftp`
    77  * `local0`
    78  * `local1`
    79  * `local2`
    80  * `local3`
    81  * `local4`
    82  * `local5`
    83  * `local6`
    84  * `local7`
    85  
    86  By default, Docker uses the first 12 characters of the container ID to tag log messages.
    87  Refer to the [log tag option documentation](/reference/logging/log_tags/) for customizing
    88  the log tag format.
    89  
    90  
    91  ## journald options
    92  
    93  The `journald` logging driver stores the container id in the journal's `CONTAINER_ID` field. For detailed information on
    94  working with this logging driver, see [the journald logging driver](/reference/logging/journald/)
    95  reference documentation.
    96  
    97  ## gelf options
    98  
    99  The GELF logging driver supports the following options:
   100  
   101      --log-opt gelf-address=udp://host:port
   102      --log-opt tag="database"
   103  
   104  The `gelf-address` option specifies the remote GELF server address that the
   105  driver connects to. Currently, only `udp` is supported as the transport and you must
   106  specify a `port` value. The following example shows how to connect the `gelf`
   107  driver to a GELF remote server at `192.168.0.42` on port `12201`
   108  
   109      $ docker run --log-driver=gelf --log-opt gelf-address=udp://192.168.0.42:12201
   110  
   111  By default, Docker uses the first 12 characters of the container ID to tag log messages.
   112  Refer to the [log tag option documentation](/reference/logging/log_tags/) for customizing
   113  the log tag format.
   114  
   115  
   116  ## fluentd options
   117  
   118  You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd logging driver options.
   119  
   120   - `fluentd-address`: specify `host:port` to connect [localhost:24224]
   121   - `tag`: specify tag for `fluentd` message,
   122  
   123  For example, to specify both additional options:
   124  
   125  `docker run --log-driver=fluentd --log-opt fluentd-address=localhost:24224 --log-opt tag=docker.{{.Name}}`
   126  
   127  If container cannot connect to the Fluentd daemon on the specified address,
   128  the container stops immediately. For detailed information on working with this
   129  logging driver, see [the fluentd logging driver](/reference/logging/fluentd/)
   130  
   131  ## Specify Amazon CloudWatch Logs options
   132  
   133  The Amazon CloudWatch Logs logging driver supports the following options:
   134  
   135      --log-opt awslogs-region=<aws_region>
   136      --log-opt awslogs-group=<log_group_name>
   137      --log-opt awslogs-stream=<log_stream_name>
   138  
   139  
   140  For detailed information on working with this logging driver, see [the awslogs logging driver](/reference/logging/awslogs/)
   141  reference documentation.