Commit Graph

35 Commits

Author SHA1 Message Date
cdf7829892 fix some typos from module contrib to man
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
Upstream-commit: e0577d5fe876ec92de21c808c31e97e052654223
Component: engine
2017-02-18 10:08:55 +08:00
79e327614e Add NILVALUE for STRUCTURED-DATA in RFC5424 logs
RFC 5424 (https://tools.ietf.org/html/rfc5424#section-6.2) requires that
STRUCTURED-DATA be present, either as NILVALUE (-) or as one or more
SD-ELEMENT items. Because Docker doesn't ever create any SD-ELEMENT items,
the format should output the NILVALUE instead. This resolves parsing issues
in various RFC 5424-compliant syslog servers.

Signed-off-by: Mark Parker <godefroi@gmail.com>
Upstream-commit: b7d802bbccdf7ec6e4cc1ead733663cdce9768c0
Component: engine
2017-02-02 15:16:14 -07:00
c238856aa4 Use sync.Pool for logger Messages
This reduces allocs and bytes used per log entry significantly as well
as some improvement to time per log operation.

Each log driver, however, must put messages back in the pool once they
are finished with the message.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 3f4fccb65f0ef286c9c4e0f01c4ae7bb09a6ad89
Component: engine
2017-02-01 13:52:37 -05:00
cabd6a6108 Rename 'context' to 'loginfo' in the logger module
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

gofmt

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

remove 'api/types/container/config.go' from this PR

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

change 'LogInfo' to 'Info'

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Upstream-commit: 17ec911da7d4b77b069d9f6c8c010865e19acc6c
Component: engine
2016-12-29 19:13:44 +08:00
6564bc722c Merge pull request #25736 from mwieczorek/25689-enable-syslog-driver-on-windows
Enable syslog driver for windows
Upstream-commit: 2c91c5fdad49ff2103ae377b5b4e1a97ebe3f402
Component: engine
2016-08-29 17:46:12 -04:00
385734b9bc Merge pull request #24153 from frodenas/syslog-fix
Syslog Driver: RFC 5425 Message Framing should be used only when protocol is TCP+TLS
Upstream-commit: 15f3d060ace45384ed5f549eecf2bc8919a82f7f
Component: engine
2016-08-25 12:15:06 -04:00
da10d8cdee Enable syslog driver for windows
Signed-off-by: Michal Wieczorek <wieczorek-michal@wp.pl>
Upstream-commit: eac70703e3f46f825354f03cac93206497143350
Component: engine
2016-08-17 22:26:24 +02:00
6e10fad8df Syslog Driver: RFC 5425 Framing should be used only when protocol is TCP+TLS
Signed-off-by: Ferran Rodenas <frodenas@gmail.com>
Upstream-commit: 4039bfc917cc1e3d7c4dd8170152740bd3ac7d41
Component: engine
2016-06-29 15:41:10 -07:00
bfa1e8baff Standardize default logging tag value
Use the same default tag value for all loggers that support tags.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: f900e1cf47f6a18eaa4ce438cc8fc0623f2eaec0
Component: engine
2016-06-04 12:38:12 +02:00
f36200bd07 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>
Upstream-commit: 38c49d99870c762a0ea23dadda414f9cc59071b6
Component: engine
2016-05-12 22:29:30 -07:00
979a878be3 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>
Upstream-commit: a20b02b9158c283402d174926c84e657e53b17a1
Component: engine
2016-05-10 07:43:44 -07:00
35425a4320 Merge pull request #21613 from wzyboy/support-unixgram-syslog-address
Support unixgram syslog address
Upstream-commit: dbee44c9e0d9f8afbbb86efd2c0bcbd66440cbbc
Component: engine
2016-04-28 11:06:17 -04:00
48a9de5e52 Support unixgram syslog address
- Consider unixgram:// as a valid URL prefix
- Parse unixgram:// addresses
- Update docs

Signed-off-by: Zhuoyun Wei <wzyboy@wzyboy.org>
Upstream-commit: 57fad95e4352c72c852d740e54fd693a446c552f
Component: engine
2016-04-28 11:04:50 +08:00
c931d8e5af enable syslog logger to have access to env and labels
Signed-off-by: Alan Scherger <flyinprogrammer@gmail.com>
Upstream-commit: f67b7112775fd9957cc156cc4483e11b8c0c981a
Component: engine
2016-04-08 19:50:18 -05:00
6e179f4b7d 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>
Upstream-commit: 7581cf96fbe0cddacf246f2982634190ebe455c9
Component: engine
2016-04-08 05:00:11 +00:00
0df74af651 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>
Upstream-commit: 1a40dd535fb12cade584f085baa23734e8a9bb0e
Component: engine
2016-03-09 22:31:11 +02:00
1c0d76c749 Add support for syslog over TLS.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 4b98193beab00bc6cf48762858570a1bd418c9ef
Component: engine
2016-01-11 12:25:34 -05:00
bd692d4b30 log driver - add ability to interpolate container context into the log tag field
Signed-off-by: Philip Monroe <phil@philmonroe.com>
Upstream-commit: 3be7146e14d1f5ced470c0c7e3066f091f468696
Component: engine
2015-09-16 15:19:28 -07:00
03328caba1 Check syslog config on daemon start
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 960791ba60621ef2b182379e7b237e681b602694
Component: engine
2015-08-17 14:29:45 -07:00
acbee0eb90 Do not allow corrupted syslog-address
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: b7a6d14bdc56e9397be8c9bef9c3d991ff30fe77
Component: engine
2015-08-17 14:19:06 -07:00
90287c6171 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>
Upstream-commit: ccbe539e86dfbb8749c09763ddfd73bf10ac57cc
Component: engine
2015-07-29 13:09:39 -07:00
fb988a52e9 add support for maximum log size, and max number of log files
Signed-off-by: wlan0 <sidharthamn@gmail.com>
Upstream-commit: 9b782d3af322bd8d9cf857d63eb7f2e0fe484c90
Component: engine
2015-07-02 06:26:06 -07:00
f157b240b8 Add --log-opt to specify facility for syslog driver
Signed-off-by: Dennis Docter <dennis@d23.nl>
Upstream-commit: 609e7b0a55d4082fce40eabae3a06ca57c188ba5
Component: engine
2015-06-23 14:04:25 +02:00
f8248bbabf Add syslog-tag option for syslog log-driver
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a81af2e26a19cca0ffb8cbfa619169d55d604789
Component: engine
2015-06-02 12:43:00 -07:00
8d306cf8a5 Add syslog-address log-opt
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: e8c88d253337776a6075c9db69140ce2c5014622
Component: engine
2015-05-29 00:42:11 +02:00
38fd09288b Windows: Factor out syslog and journald
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 655a58e27bfcfd2494bb5d46f95cb49d655ad17a
Component: engine
2015-05-14 10:34:09 -07:00
b1b57c9cd4 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>
Upstream-commit: 3a8728b431df07249ad913ea9a12e27dc39b8956
Component: engine
2015-05-12 19:11:52 +00:00
78dcc43512 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>
Upstream-commit: 05641ccffc5088a382fa3bfb21f1276ccb6c1fc0
Component: engine
2015-04-15 12:46:43 -07:00
73f3660a47 move syslog-tag to syslog.New function
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 4f91a333d5c9d66ce109c36e7261dbfd3382ebbf
Component: engine
2015-04-13 11:24:18 -07:00
68100310d8 Removed unused "mutex" field
fixes #11659

Signed-off-by: Alena Prokharchyk <alena@rancher.com>
Upstream-commit: dabd8a02aeff8b2122efa0b55de4ba52c429f936
Component: engine
2015-03-23 19:05:21 -07:00
59aa846db8 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>
Upstream-commit: f2c7b4d7437443d469b2247362835af02ccef385
Component: engine
2015-03-24 01:35:54 +03:00
974bfa30e6 Merge pull request #11654 from runcom/11650-syslog-close-redunant-nil-check
syslog Close() - Remove redunant nil check, s.writer cannot be nil
Upstream-commit: 2717302cc69c865cfec02fb48b3cb173d6980364
Component: engine
2015-03-23 12:32:26 -07:00
84d2a9e3ec Remove redunant nil check, s.writer cannot be nil
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: e600df2d9732b8c40d056563e361ded6cd5ce773
Component: engine
2015-03-23 20:03:24 +01:00
1ef60888a8 Refactor syslog Log else clause
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 8f025aae36fd040d8d2617890b258b5460ae44db
Component: engine
2015-03-23 20:01:01 +01:00
a7d21898b0 add syslog driver
Signed-off-by: wlan0 <sid@rancher.com>
Upstream-commit: eaecd8b1b5871a4d17be27e3615106587eec1d3a
Component: engine
2015-03-21 18:01:18 -07:00