Commit Graph

26 Commits

Author SHA1 Message Date
Yong Tang 38c49d9987 Remove `docker/` prefix from log messages tag.
This fix tries to address the issue raised in #22358 where syslog's
message tag always starts with `docker/` and can not be removed
by changing the log tag templates.

The issue is that syslog driver hardcodes `path.Base(os.Args[0])`
as the prefix, which is the binary file name of the daemon (`dockerd`).
This could be an issue for certain situations (e.g., #22358) where
user may prefer not to have a dedicated prefix in syslog messages.
There is no way to override this behavior in the current verison of
the docker.

This fix tries to address this issue without making changes in the
default behavior of the syslog driver. An additional
`{{.DaemonName}}` has been introduced in the syslog tag. This is
assigned as the `docker` when daemon starts. The default log tag
template has also been changed from
`path.Base(os.Args[0]) + "/{{.ID}}"` to `{{.DaemonName}}/{{.ID}}`.
Therefore, there is no behavior changes when log-tag is not provided.

In order to be consistent, the default log tag for fluentd has been
changed from `docker.{{.ID}}` to `{{DaemonName}}.{{.ID}}` as well.

The documentation for log-tag has been updated to reflect this change.

Additional test cases have been added to cover changes in this fix.

This fix fixes #22358.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-05-12 22:29:30 -07:00
Yong Tang a20b02b915 Remove deprecated driver specific log tags
Since 1.9, driver specific log tag options
`syslog-tag`
`gelf-tag`
`fluentd-tag`
have been deprecated in favor of the generic tag
option which is standard across different logging
drivers.

This fix removed the deprecated driver specific
log tag options of `syslog-tag`, `gelf-tag`,
`fluentd-tag` for 1.12 and updated the docs.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-05-10 07:43:44 -07:00
Brian Goff dbee44c9e0 Merge pull request #21613 from wzyboy/support-unixgram-syslog-address
Support unixgram syslog address
2016-04-28 11:06:17 -04:00
Zhuoyun Wei 57fad95e43
Support unixgram syslog address
- Consider unixgram:// as a valid URL prefix
- Parse unixgram:// addresses
- Update docs

Signed-off-by: Zhuoyun Wei <wzyboy@wzyboy.org>
2016-04-28 11:04:50 +08:00
Alan Scherger f67b711277 enable syslog logger to have access to env and labels
Signed-off-by: Alan Scherger <flyinprogrammer@gmail.com>
2016-04-08 19:50:18 -05:00
Yong Tang 7581cf96fb Additional syslog-format option to allow microsecond resolution in syslog timestamp.
This fix tries to add an additional syslog-format of `rfc5424micro` which follows
the same as rfc5424 except that it use microsecond resolution for timestamp. The
purpose is to solve the issue raised in #21793 where log events might lose its
ordering if happens on the same second.

The timestamp field in rfc5424 is derived from rfc3339, though the maximium
resolution is limited to "TIME-SECFRAC" which is 6 (microsecond resolution).

The appropriate documentation (`docs/admin/logging/overview.md`) has been updated
to reflect the change in this fix.

This fix adds a unit test to cover the newly introduced format.

This fix fixes #21793.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-04-08 05:00:11 +00:00
Solganik Alexander 1a40dd535f Fixes #18712. Add rfc5424 log format for syslog.
Previously docker used obsolete rfc3164 syslog format for syslog. rfc3164 explicitly
uses semicolon as a separator between 'TAG' and 'Content' section of the log message.
Docker uses semicolon as a separator between image name and version tag.
When {{.ImageName}} was used as a tag expression and contained ":" syslog parser mistreated
"tag" part of the image name as syslog message body, which resulted in incorrect "syslogtag" been reported by syslog
daemon.
Use of rfc5424 log format partually fixes the issue as it does not use semicolon as a separator.
However using default rfc5424 syslog format itroduces backward incompatability because rsyslog template keyword  %syslogtag%
is parsed differently. In rfc3164 it uses the "TAG" part reported before the "pid" part. In rfc5424 it uses "appname" part reported
before the pid part, while tag part is introduced by %msgid% part.
For more information on rsyslog configuration properties see: http://www.rsyslog.com/doc/master/configuration/properties.html

Added two options to specify logging in either rfc5424, rfc3164 format or unix format omitting hostname in order to keep backwards compatability with
previous versions.

Signed-off-by: Solganik Alexander <solganik@gmail.com>
2016-03-09 22:31:11 +02:00
David Calavera 4b98193bea Add support for syslog over TLS.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-11 12:25:34 -05:00
Philip Monroe 3be7146e14 log driver - add ability to interpolate container context into the log tag field
Signed-off-by: Philip Monroe <phil@philmonroe.com>
2015-09-16 15:19:28 -07:00
Alexander Morozov 960791ba60 Check syslog config on daemon start
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-08-17 14:29:45 -07:00
Alexander Morozov b7a6d14bdc Do not allow corrupted syslog-address
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-08-17 14:19:06 -07:00
Morgan Bauer ccbe539e86
golint fixes for daemon/logger/*
- downcase and privatize exported variables that were unused
 - make accurate an error message
 - added package comments
 - remove unused var ReadLogsNotSupported
 - enable linter
 - some spelling corrections

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-07-29 13:09:39 -07:00
wlan0 9b782d3af3 add support for maximum log size, and max number of log files
Signed-off-by: wlan0 <sidharthamn@gmail.com>
2015-07-02 06:26:06 -07:00
Dennis Docter 609e7b0a55 Add --log-opt to specify facility for syslog driver
Signed-off-by: Dennis Docter <dennis@d23.nl>
2015-06-23 14:04:25 +02:00
Alexander Morozov a81af2e26a Add syslog-tag option for syslog log-driver
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-06-02 12:43:00 -07:00
Antonio Murdaca e8c88d2533 Add syslog-address log-opt
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-29 00:42:11 +02:00
John Howard 655a58e27b Windows: Factor out syslog and journald
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-14 10:34:09 -07:00
Ahmet Alp Balkan 3a8728b431 daemon: Logging drivers refactoring
- noplog driver pkg for '--log-driver=none' (null object pattern)
- centralized factory for log drivers (instead of case/switch)
- logging drivers registers themselves to factory upon import
  (easy plug/unplug of drivers in daemon/logdrivers.go)
- daemon now doesn't start with an invalid log driver
- Name() method of loggers is actually now their cli names (made it useful)
- generalized Read() logic, made it unsupported except json-file (preserves
  existing behavior)

Spotted some duplication code around processing of legacy json-file
format, didn't touch that and refactored in both places.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-05-12 19:11:52 +00:00
Darren Shepherd 05641ccffc Change syslog format and facility
This patch changes two things

1. Set facility to LOG_DAEMON
2. Remove ": " from tag so that the tag + pid become a single column in
   the log

Signed-off-by: Darren Shepherd <darren@rancher.com>
2015-04-15 12:46:43 -07:00
Deng Guangxing 4f91a333d5 move syslog-tag to syslog.New function
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-04-13 11:24:18 -07:00
Alena Prokharchyk dabd8a02ae Removed unused "mutex" field
fixes #11659

Signed-off-by: Alena Prokharchyk <alena@rancher.com>
2015-03-23 19:05:21 -07:00
Anton Tiurin f2c7b4d743 Syslog.Log - Remove redundant cast of msg.Line []byte to string as
it's a fmt.Sprintf responsibility.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-03-24 01:35:54 +03:00
Alexander Morozov 2717302cc6 Merge pull request #11654 from runcom/11650-syslog-close-redunant-nil-check
syslog Close() - Remove redunant nil check, s.writer cannot be nil
2015-03-23 12:32:26 -07:00
Antonio Murdaca e600df2d97 Remove redunant nil check, s.writer cannot be nil
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-23 20:03:24 +01:00
Antonio Murdaca 8f025aae36 Refactor syslog Log else clause
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-23 20:01:01 +01:00
sidharthamani eaecd8b1b5 add syslog driver
Signed-off-by: wlan0 <sid@rancher.com>
2015-03-21 18:01:18 -07:00