From f8248bbabfe8bdba234221a4e814355a32c365b0 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Tue, 2 Jun 2015 12:43:00 -0700 Subject: [PATCH 1/3] Add syslog-tag option for syslog log-driver Signed-off-by: Alexander Morozov Upstream-commit: a81af2e26a19cca0ffb8cbfa619169d55d604789 Component: engine --- components/engine/daemon/logger/syslog/syslog.go | 5 ++++- components/engine/docs/sources/reference/run.md | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/engine/daemon/logger/syslog/syslog.go b/components/engine/daemon/logger/syslog/syslog.go index 706a0ef912..b986364310 100644 --- a/components/engine/daemon/logger/syslog/syslog.go +++ b/components/engine/daemon/logger/syslog/syslog.go @@ -29,7 +29,10 @@ func init() { } func New(ctx logger.Context) (logger.Logger, error) { - tag := ctx.ContainerID[:12] + tag := ctx.Config["syslog-tag"] + if tag == "" { + tag = ctx.ContainerID[:12] + } proto, address, err := parseAddress(ctx.Config["syslog-address"]) if err != nil { diff --git a/components/engine/docs/sources/reference/run.md b/components/engine/docs/sources/reference/run.md index f1c4a44d7c..0806c91ea2 100644 --- a/components/engine/docs/sources/reference/run.md +++ b/components/engine/docs/sources/reference/run.md @@ -884,6 +884,7 @@ The following logging options are supported for this logging driver: --log-opt address=[tcp|udp]://host:port --log-opt address=unix://path + --log-opt syslog-tag="mailer" `address` specifies the remote syslog server address where the driver connects to. If not specified it defaults to the local unix socket of the running system. @@ -893,6 +894,8 @@ remote server at `192.168.0.42` on port `123` $ docker run --log-driver=syslog --log-opt address=tcp://192.168.0.42:123 +`syslog-tag` specifies tag for syslog messages from container. + #### Logging driver: journald Journald logging driver for Docker. Writes log messages to journald; the container id will be stored in the journal's `CONTAINER_ID` field. `docker logs` command is not available for this logging driver. For detailed information on working with this logging driver, see [the journald logging driver](reference/logging/journald) reference documentation. From 075ef8562695af33c7ceca6249ea8d52ca18633a Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Tue, 2 Jun 2015 12:44:23 -0700 Subject: [PATCH 2/3] Change address to syslog-address in syslog docs Signed-off-by: Alexander Morozov Upstream-commit: 8979fe4d8a11d5f38e09e4acc6268c56d40ef151 Component: engine --- components/engine/docs/sources/reference/run.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/engine/docs/sources/reference/run.md b/components/engine/docs/sources/reference/run.md index 0806c91ea2..7438fe8cd6 100644 --- a/components/engine/docs/sources/reference/run.md +++ b/components/engine/docs/sources/reference/run.md @@ -882,17 +882,17 @@ command is not available for this logging driver The following logging options are supported for this logging driver: - --log-opt address=[tcp|udp]://host:port - --log-opt address=unix://path + --log-opt syslog-address=[tcp|udp]://host:port + --log-opt syslog-address=unix://path --log-opt syslog-tag="mailer" -`address` specifies the remote syslog server address where the driver connects to. +`syslog-address` specifies the remote syslog server address where the driver connects to. If not specified it defaults to the local unix socket of the running system. If transport is either `tcp` or `udp` and `port` is not specified it defaults to `514` The following example shows how to have the `syslog` driver connect to a `syslog` remote server at `192.168.0.42` on port `123` - $ docker run --log-driver=syslog --log-opt address=tcp://192.168.0.42:123 + $ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123 `syslog-tag` specifies tag for syslog messages from container. From b5081143587d260e1f08b2361278cfda3cc4f5bf Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Tue, 2 Jun 2015 12:46:51 -0700 Subject: [PATCH 3/3] Wrap lines for journald docs Signed-off-by: Alexander Morozov Upstream-commit: 3df19749d420b1fae07cb4d7c5b61fbb53b15fa9 Component: engine --- components/engine/docs/sources/reference/run.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/engine/docs/sources/reference/run.md b/components/engine/docs/sources/reference/run.md index 7438fe8cd6..1f75b87c4c 100644 --- a/components/engine/docs/sources/reference/run.md +++ b/components/engine/docs/sources/reference/run.md @@ -898,7 +898,11 @@ remote server at `192.168.0.42` on port `123` #### Logging driver: journald -Journald logging driver for Docker. Writes log messages to journald; the container id will be stored in the journal's `CONTAINER_ID` field. `docker logs` command is not available for this logging driver. For detailed information on working with this logging driver, see [the journald logging driver](reference/logging/journald) reference documentation. +Journald logging driver for Docker. Writes log messages to journald; the +container id will be stored in the journal's `CONTAINER_ID` field. `docker logs` +command is not available for this logging driver. For detailed information on +working with this logging driver, see [the journald logging driver](reference/logging/journald) +reference documentation. The following logging options are supported for this logging driver: [none]