Commit graph

525 commits

Author SHA1 Message Date
Anusha Ragunathan
59698778fe
Merge pull request #37084 from nwneisen/update-ring-buffer-documents
Update documentation for RingLogger's ring buffer
2018-05-17 12:10:44 -07:00
Nick Neisen
3521d534e5 Update documentation for RingLogger's ring buffer
Signed-off-by: Nick Neisen <nwneisen@gmail.com>
2018-05-16 18:52:50 -06:00
Sebastiaan van Stijn
6821ffd1a1
Merge pull request #37028 from cpuguy83/log_plugin_broken_pipe
Fix logging plugin crash unrecoverable
2018-05-15 13:57:01 +02:00
Brian Goff
e7479e3ab8 Fix logging plugin crash unrecoverable
In cases where a logging plugin has crashed when the daemon tries to
copy the container stdio to the logging plugin it returns a broken pipe
error and any log entries that occurr while the plugin is down are lost.

Fix this by opening read+write in the daemon so logs are not lost while
the plugin is down.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-14 16:51:56 -04:00
Brian Goff
e87e9e6ad6 Fix some issues in logfile reader and rotation
- Check errors.Cause(err) when comparing errors
- Fix bug where oldest log file is not actually removed. This in
particular causes issues when compression is enabled. On rotate it just
overwrites the data in the log file corrupting it.
- Use O_TRUNC to open new gzip files to ensure we don't corrupt log
files as happens without the above fix.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-14 15:52:18 -04:00
Brian Goff
673dd28e7e Add metrics for log failures/partials
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-10 17:22:37 -04:00
Sebastiaan van Stijn
daaef83cd2
Fix fluentd partial detection
The Partial property of the Logger message
was replaced by PLogMetaData, causing the build to fail.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-10 01:55:27 +02:00
Sebastiaan van Stijn
fff01bc14d
Merge pull request #36159 from cosmo0920/add-partial-flag-into-record
Fluentd Log Driver: Add partial flag into record
2018-05-09 21:01:05 +02:00
Brian Goff
fe2d3a1551
Merge pull request #36522 from IRCody/awslogs-non-blocking
Allow awslogs to use non-blocking mode
2018-05-01 16:30:52 -04:00
Cody Roseborough
c7e379988c Allow awslogs to use non-blocking mode
When then non-blocking mode is specified, awslogs will:

- No longer potentially block calls to logstream.Log(), instead will
  return an error if the awslogs buffer is full. This has the effect of
  dropping log messages sent to awslogs.Log() that are made while the
  buffer is full.
- Wait to initialize the log stream until the first Log() call instead of in
  New(). This has the effect of allowing the container to start in
  the case where Cloudwatch Logs is unreachable.

Both of these changes require the --log-opt mode=non-blocking to be
explicitly set and do not modify the default behavior.

Signed-off-by: Cody Roseborough <crrosebo@amazon.com>
2018-04-27 17:59:03 +00:00
Kir Kolyshkin
7d62e40f7e Switch from x/net/context -> context
Since Go 1.7, context is a standard package. Since Go 1.9, everything
that is provided by "x/net/context" is a couple of type aliases to
types in "context".

Many vendored packages still use x/net/context, so vendor entry remains
for now.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-23 13:52:44 -07:00
Tibor Vass
61138fb5fc
Merge pull request #35739 from thaJeztah/bump-go-1.10
Bump Golang to 1.10.1
2018-04-13 13:56:38 -10:00
Derek McGowan
c208f1c8a8
Update logger adapter test to avoid race
Add synchronization around adding logs to a plugin
and reading those logs. Without the follow configuration,
a race occurs between go routines to add the logs into
the plugin and read the logs out of the plugin. This
adds a function to synchronize the action to avoid the
race.
Removes use of file for buffering, instead buffering whole
messages so log count can be checked discretely.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-04-12 13:35:15 -07:00
Anusha Ragunathan
0b4b0a7b5d Improve partial message support in logger
Docker daemon has a 16K buffer for log messages. If a message length
exceeds 16K, it should be split by the logger and merged at the
endpoint.

This change adds `PartialLogMetaData` struct for enhanced partial support
- LastPartial (bool) : indicates if this is the last of all partials.
- ID (string)        : unique 32 bit ID. ID is same across all partials.
- Ordinal (int starts at 1) : indicates the position of msg in the series of partials.
Also, the timestamps across partials in the same.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
2018-04-11 13:26:28 -07:00
Brian Goff
c4e93da8a6
Merge pull request #29932 from miaoyq/container-log-add-archive
add support for compressibility of log file
2018-03-19 15:20:17 -04:00
Daniel Nephin
c9e52bd0da Post migration assertion fixes
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-16 11:03:46 -04:00
Daniel Nephin
6be0f70983 Automated migration using
gty-migrate-from-testify --ignore-build-tags

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-16 11:03:43 -04:00
Daniel Nephin
ef01dea893 Cleanup some assertions
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-16 10:54:54 -04:00
Yanqiang Miao
f69f09f44c add compress option for 'jsonfiles' log driver
This PR adds support for compressibility of log file.
I added a new option conpression for the jsonfile log driver,
this option allows the user to specify compression algorithm to
compress the log files. By default, the log files will be
not compressed. At present, only support 'gzip'.

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

'docker logs' can read from compressed files

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

Add Metadata to the gzip header, optmize 'readlog'

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2018-03-15 20:20:05 +08:00
Benjamin Yolken
d0c1287a8d
Make logfile perms configurable
Signed-off-by: Benjamin Yolken <yolken@stripe.com>
2018-03-07 15:18:51 -08:00
Cody Roseborough
a1956b5623 daemon/logger/ring.go: log error not instance
Log the error returned from logdriver.Log() instead of the logdriver
itself.

Signed-off-by: Cody Roseborough <crrosebo@amazon.com>
2018-03-03 16:29:57 +00:00
Brian Goff
a1afe38e52
Merge pull request #36272 from mnussbaum/36255-fix_log_path
Fix empty LogPath with non-blocking logging mode
2018-02-27 11:25:39 -05:00
Sebastiaan van Stijn
20028325da
Merge pull request #35829 from cpuguy83/no_private_mount_for_plugins
Perform plugin mounts in the runtime
2018-02-21 12:28:13 +01:00
junzhe and mnussbaum
20ca612a59 Fix empty LogPath with non-blocking logging mode
This fixes an issue where the container LogPath was empty when the
non-blocking logging mode was enabled. This change sets the LogPath on
the container as soon as the path is generated, instead of setting the
LogPath on a logger struct and then attempting to pull it off that
logger at a later point. That attempt to pull the LogPath off the logger
was error prone since it assumed that the logger would only ever be a
single type.

Prior to this change docker inspect returned an empty string for
LogPath. This caused issues with tools that rely on docker inspect
output to discover container logs, e.g. Kubernetes.

This commit also removes some LogPath methods that are now unnecessary
and are never invoked.

Signed-off-by: junzhe and mnussbaum <code@getbraintree.com>
2018-02-20 23:12:34 -08:00
Weerasak Chongnguluam
6e5fba98a5 Remove unused method from multireader package
Signed-off-by: Weerasak Chongnguluam <singpor@gmail.com>
2018-02-15 23:10:56 +07:00
Brian Goff
f40860c5f3 Fix log tail with empty logs
When tailing a container log, if the log file is empty it will cause the
log stream to abort with an unexpected `EOF`.
Note that this only applies to the "current" log file as rotated files
cannot be empty.

This fix just skips adding the "current" file the log tail if it is
empty.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-02-13 21:33:05 -05:00
bin liu
b00a67be6e Fix typos in daemon
Signed-off-by: bin liu <liubin0329@gmail.com>
2018-02-10 19:42:54 +08:00
Vincent Demeester
f653485e57
Merge pull request #36220 from dnephin/support-proxy-in-splunk-driver
Support a proxy in splunk log driver
2018-02-08 15:32:19 +01:00
Brian Goff
0e5eaf8ee3 Ensure plugin returns correctly scoped paths
Before this change, volume management was relying on the fact that
everything the plugin mounts is visible on the host within the plugin's
rootfs. In practice this caused some issues with mount leaks, so we
changed the behavior such that mounts are not visible on the plugin's
rootfs, but available outside of it, which breaks volume management.

To fix the issue, allow the plugin to scope the path correctly rather
than assuming that everything is visible in `p.Rootfs`.
In practice this is just scoping the `PropagatedMount` paths to the
correct host path.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-02-07 15:48:27 -05:00
Daniel Nephin
3c4537d5b3 Support a proxy in splunk log driver
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-07 14:52:32 -05:00
Daniel Nephin
4f0d95fa6e Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-05 16:51:57 -05:00
Hiroshi Hatake
3ed3b33e55 Fluentd Log Driver: Add partial flag into record
Signed-off-by: Hiroshi Hatake <hatake@clear-code.com>
2018-01-31 11:52:03 +09:00
Yong Tang
a636ed5ff4
Merge pull request #36078 from mixja/multiline-max-event-processing
awslogs - don't add new lines to maximum sized events
2018-01-24 12:06:49 -08:00
Justin Menga
d3e2d55a3d Don't append new line for maximum sized events
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2018-01-21 14:29:55 +13:00
Yong Tang
e77267c5a6 Carry 34248 Added tag log option to json-logger and use RawAttrs
This fix carries PR 34248: Added tag log option to json-logger

This fix changes to use RawAttrs based on review feedback.

This fix fixes 19803, this fix closes 34248.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-19 17:51:20 +00:00
bonczj
5f50f4f511 Added tag log option to json-logger
Fixes #19803
Updated the json-logger to utilize the common log option
'tag' that can define container/image information to include
as part of logging.

When the 'tag' log option is not included, there is no change
to the log content via the json-logger. When the 'tag' log option
is included, the tag will be parsed as a template and the result
will be stored within each log entry as the attribute 'tag'.

Update: Removing test added to integration_cli as those have been deprecated.
Update: Using proper test calls (require and assert) in jsonfilelog_test.go based on review.
Update: Added new unit test configs for logs with tag. Updated unit test error checking.
Update: Cleanup check in jsonlogbytes_test.go to match pending changes in PR #34946.
Update: Merging to correct conflicts from PR #34946.

Signed-off-by: bonczj <josh.bonczkowski@gmail.com>
2018-01-19 17:41:19 +00:00
Yong Tang
39faf2a3a8
Merge pull request #35509 from cpuguy83/splunk_dont_readall
Splunk: limit the reader size on error responses
2018-01-05 12:34:35 -08:00
Sebastiaan van Stijn
d80c13a541
Merge pull request #35570 from zemanlx/feature/journald-with-SYSLOG_IDENTIFIER
Add journald tag as SYSLOG_IDENTIFIER
2018-01-05 20:56:55 +01:00
Sebastiaan van Stijn
c8f7f4489e
Merge pull request #35726 from jahkeup/awslogs-batching
Fix awslogs batch size calculation
2017-12-19 20:44:33 +01:00
Sebastiaan van Stijn
6ed1163c98
Remove redundant build-tags
Files that are suffixed with `_linux.go` or `_windows.go` are
already only built on Linux / Windows, so these build-tags
were redundant.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-12-18 17:41:53 +01:00
Jacob Vallejo
ad14dbf134 awslogs: Use batching type for ergonomics and correct counting
The previous bytes counter was moved out of scope was not counting the
total number of bytes in the batch. This type encapsulates the counter
and the batch for consideration and code ergonomics.

Signed-off-by: Jacob Vallejo <jakeev@amazon.com>
2017-12-13 15:27:16 -08:00
Brian Goff
7f14542ddd Splunk: limit the reader size on error responses
Before this patch, if a splunk endpoint returned a non-OK status, the
splunk driver would read the entire response body. This could lead to
excessive memory allocations. Instead put a cap on the amount the driver
will read from the response body.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-12-07 11:22:58 -05:00
Sebastiaan van Stijn
3461289bf0
Merge pull request #35529 from dungeonmaster18/subsecond-precision-config
Added SubSecondPrecision to config option.
2017-12-05 10:14:14 -08:00
Umesh Yadav
a1ebda09ba
Added SubSecondPrecision flag in fluentd logger
Signed-off-by: dungeonmaster18 <umesh4257@gmail.com>
2017-12-05 17:21:57 +05:30
Victor Vieux
3a9ab941ad
Merge pull request #35628 from ikarpovich/35626-le-line-only-legacy
Logentries line-only logopt fix to maintain backwards compatibility
2017-11-30 15:48:56 -08:00
Yong Tang
88e36dcc76
Merge pull request #35496 from cpuguy83/add_timeouts_to_splunk_post
Set timeout on splunk batch send
2017-11-30 09:47:48 -08:00
Igor Karpovich
27a5b878c1 Logentries line-only logopt fix to maintain backwards compatibility
Changed logic to ignore empty value

Fixes #35626

Signed-off-by: Igor Karpovich <igor@karpovich.me>
2017-11-30 13:03:16 +00:00
Igor Karpovich
440e50b6c7 This fixes casting of log message []byte into string with --log-opt line-only=true
Signed-off-by: Igor Karpovich <igor@karpovich.me>
2017-11-27 14:26:53 +00:00
Vlastimil Zeman
ae557f9d85
Add journald tag as SYSLOG_IDENTIFIER
Signed-off-by: Vlastimil Zeman <vlastimil.zeman@diffblue.com>
2017-11-22 08:51:23 +00:00
Brian Goff
24087399d9 Set timeout on splunk batch send
Before this change, if the splunk endpoint is blocked it will cause a
deadlock on `Close()`.
This sets a reasonable timeout for the http request to send a log batch.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-11-14 12:32:52 -05:00
John Stephens
72e179aa04
Merge pull request #35073 from mle-ii/master
Add gelf log driver plugin to Windows build
2017-11-08 14:53:56 -08:00
Brian Goff
16f7cd6749 Move json log reading into log file object
This allows much of the read logic to be shared for other things,
especially for the new log driver proposed in
https://github.com/moby/moby/issues/33475

The only logic for reads in the json logger is around decoding log
messages, which gets passed into the log file object.

This also helps with implementing compression as it allows us to
simplify locking strategies.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-11-04 08:31:58 -04:00
Brian Goff
52d82b4fbc Refactor log file writer
Make the `*RotateFileWriter` specifically about writing
`logger.Message`'s, which is what it's used for.

This allows for future changes where the log writer can cache details
about log entries such as (e.g.) the timestamps included in a particular
log file, which can be used to optimize reads.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-11-04 08:15:20 -04:00
Sebastiaan van Stijn
68a4552529
Merge pull request #32914 from jamiehannaford/until-logging
Add --until flag for docker logs; closes #32807
2017-11-03 16:08:30 +01:00
Yong Tang
4785f1a7ab Remove solaris build tag and `contrib/mkimage/solaris
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-11-02 00:01:46 +00:00
Jamie Hannaford
e8d9a61f4c Add --until flag for docker logs; closes #32807
Signed-off-by: Jamie Hannaford <jamie.hannaford@rackspace.com>
2017-11-01 10:08:49 +01:00
Yong Tang
dfc2d62632
Merge pull request #34888 from jahkeup/sized-logger
logger: copy to log driver's bufsize, fixes #34887
2017-10-30 12:37:41 -07:00
Jacob Vallejo
e1ada0b885 logger: copy to log driver's bufsize
Log drivers may have an internal buffer size that can be accommodated
by the copier as it is more effective to buffer and send fewer though
larger messages that the log driver can consume.

This eliminates the need for Partial handling for drivers that do not
support the concept (ie: awslogs, which can only have events up to
service limits).

Signed-off-by: Jacob Vallejo <jakeev@amazon.com>
2017-10-30 16:25:09 +00:00
Michael Crosby
158c072bde Merge pull request #35055 from adnxn/creds-endpoint
Add credentials endpoint option for awslogs driver
2017-10-24 14:45:14 -04:00
Kenfe-Mickael Laventure
ddae20c032
Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-20 07:11:37 -07:00
Brian Goff
3437f0f4e5 Merge pull request #34758 from ghislainbourgeois/33495-add-tcp-to-gelf-log-driver
Add TCP support for GELF log driver
2017-10-10 10:26:01 -04:00
Mike Estes
10b449b997 Add gelf log driver plugin to Windows build
Signed-off-by: Mike Estes <mle_ii@yahoo.com>
2017-10-03 12:42:54 -07:00
Adnan Khan
c7cc9d6759 Add credentials endpoint option for awslogs driver
Signed-off-by: Adnan Khan <adnkha@amazon.com>
2017-10-02 00:25:49 -07:00
Daniel Nephin
035604cca6 Move jsonlog to a subpackage of jsonfilelog
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-25 16:07:25 -04:00
Daniel Nephin
a06ad2792a Fix benchmarks and remove more unnecessary code.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-25 16:07:25 -04:00
Daniel Nephin
231c5cbd50 Remove unused JSONLog marshaling
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-25 16:07:25 -04:00
Daniel Nephin
7de92de636 Unexport FastTimeMarshalJSON
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-25 16:07:25 -04:00
Daniel Nephin
27cfa68af1 Move RFC3339NanoFixed to a more appropriate package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-25 16:07:24 -04:00
Vincent Demeester
5c57ca17d5 Merge pull request #34520 from fnoeding/fixed-raw-splunk-logger
Fixed `raw` mode splunk logger
2017-09-19 10:53:01 +02:00
Daniel Nephin
f7f101d57e Add gosimple linter
Update gometalinter

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-12 12:09:59 -04:00
Ghislain Bourgeois
e17f351114 Add TCP support for GELF log driver
Signed-off-by: Ghislain Bourgeois <ghislain.bourgeois@gmail.com>
2017-09-06 17:45:26 -04:00
Ghislain Bourgeois
e21f7b6e76 Add support for TCP parameters
Signed-off-by: Ghislain Bourgeois <ghislain.bourgeois@gmail.com>
2017-09-06 15:55:58 -04:00
Ghislain Bourgeois
72f5e5e84f Remove empty gelf_unsupported.go
Signed-off-by: Ghislain Bourgeois <ghislain.bourgeois@gmail.com>
2017-09-06 15:55:58 -04:00
Ghislain Bourgeois
b24c8e07f1 Update to latest go-gelf version and add tests
Signed-off-by: Ghislain Bourgeois <ghislain.bourgeois@gmail.com>
2017-09-06 15:55:58 -04:00
Vincent Demeester
b3b630655d Merge pull request #31727 from sascha-andres/31726-le-lion-only
Log payload only [logentries]
2017-08-22 14:59:28 +02:00
Daniel Nephin
9b47b7b151 Fix golint errors.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-18 14:23:44 -04:00
Florian Noeding
5f6d6a5093 Fixed raw mode splunk logger
Splunk HEC does not accept log events with an empty string or a
whitespace-only string.

Signed-off-by: Florian Noeding <florian@noeding.com>
2017-08-18 12:03:43 +02:00
Brian Goff
ebcb7d6b40 Remove string checking in API error handling
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-15 16:01:11 -04:00
Vincent Demeester
9ef3b53597
Move pkg/templates away
- Remove unused function and variables from the package
- Remove usage of it from `profiles/apparmor` where it wasn't required
- Move the package to `daemon/logger/templates` where it's only used

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-08-08 18:16:41 +02:00
Sascha Andres
6362843e67 Log payload only [logentries]
If you want to use the advanced query in logentries
logging in json is very useful. If you do not need
the advanced information with
--log-opt line-only=true just logs the payload

Signed-off-by: Sascha Andres <sascha.andres@outlook.com>
2017-08-05 09:54:21 +02:00
Derek McGowan
1009e6a40b
Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-31 13:16:46 -07:00
Justin Menga
0fd5a0bab7 Fix awslogs driver repeating last event - #34292
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-07-28 20:33:14 +12:00
Aaron Lehmann
b642b3f21f Avoid using a map for log attributes
Having a map per log entry seemed heavier than necessary. These
attributes end up being sorted and serialized, so storing them in a map
doesn't add anything (there's no random access element). In SwarmKit,
they originate as a slice, so there's an unnecessary conversion to a map
and back.

This also fixes the sort comparator, which used to inefficiently split
the string on each comparison.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-07-18 19:01:20 -07:00
tim
cb972b1515 Replaces fluentd-address string by constant
Signed-off-by: tim <tim@fewagainstmany.com>
2017-07-16 23:06:57 -07:00
Christopher Jones
069fdc8a08
[project] change syscall to /x/sys/unix|windows
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2017-07-11 08:00:32 -04:00
Aaron Lehmann
3be2273d03 Merge pull request #33713 from x1022as/error_fd
fd leak and error handling
2017-07-06 16:47:34 -07:00
Sebastiaan van Stijn
db8c2651b8 Merge pull request #33897 from cpuguy83/jsonfile_log_blocking
Fix log readers can block writes indefinitely
2017-07-05 18:21:14 -07:00
Brian Goff
e2209185ed Fix log readers can block writes indefinitely
Before this patch, a log reader is able to block all log writes
indefinitely (and other operations) by simply opening the log stream and
not consuming all the messages.

The reason for this is we protect the read stream from corruption by
ensuring there are no new writes while the log stream is consumed (and
caught up with the live entries).

We can get around this issue because log files are append only, so we
can limit reads to only the section of the file that was written to when
the log stream was first requested.

Now logs are only blocked until all files are opened, rather than
streamed to the client.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-07-05 14:04:52 -04:00
Vincent Demeester
ff4f700f74 Merge pull request #33322 from jsoref/spelling
Spelling
2017-07-04 15:46:34 +02:00
Brian Goff
c2ad549533 Merge pull request #33213 from gkze/master
GCP Logs: send log text as jsonPayload.message instead of jsonPayload.data
2017-07-03 16:18:18 -04:00
Josh Soref
39bcaee47b
Spelling fixes
* additional
* ambiguous
* anonymous
* anything
* application
* because
* before
* building
* capabilities
* circumstances
* commit
* committer
* compresses
* concatenated
* config
* container
* container's
* current
* definition
* delimiter
* disassociates
* discovery
* distributed
* doesnotexist
* downloads
* duplicates
* either
* enhancing
* enumerate
* escapable
* exactly
* expect
* expectations
* expected
* explicitly
* false
* filesystem
* following
* forbidden
* git with
* healthcheck
* ignore
* independent
* inheritance
* investigating
* irrelevant
* it
* logging
* looking
* membership
* mimic
* minimum
* modify
* mountpoint
* multiline
* notifier
* outputting
* outside
* overridden
* override
* parsable
* plugins
* precedence
* propagation
* provided
* provides
* registries
* repositories
* returning
* settings
* should
* signals
* someone
* something
* specifically
* successfully
* synchronize
* they've
* thinking
* uninitialized
* unintentionally
* unmarshaling
* unnamed
* unreferenced
* verify

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-03 13:13:09 -07:00
Lei Jitang
96ea8eaa15 Fix wrong filemode for rotate log files
the filemode should be 0640 but not 06400

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2017-07-03 03:49:22 -04:00
David Glasser
917050c572 Fix stderr logging for journald and syslog
logger.PutMessage, added in #28762 (v17.04.0-ce), clears msg.Source. So journald
and syslog were treating stderr messages as if they were stdout.

Signed-off-by: David Glasser <glasser@davidglasser.net>
2017-06-26 14:37:43 -07:00
Deng Guangxing
0042f992d8 fd leak and error handling
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
2017-06-23 15:38:35 +08:00
Royce Remer
b3add005d5 * standardize timeouts for log reads and writes for logger adapter tests
* use an assertion framework in logger adapter tests

Signed-off-by: Royce Remer <royceremer@gmail.com>
2017-06-18 18:47:45 -07:00
Peter Bücker
e908e1a357 Logging driver should receive same file in start/stop request
Signed-off-by: Peter Bücker <peter.buecker@gmail.com>
2017-06-08 10:05:52 +02:00
Victor Vieux
2445e6b99d move multireader out of /pkg
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-06-01 16:22:00 -07:00
Sebastiaan van Stijn
07b51ed300 Don't log error if file is already closed
When closing the log-file, and the file is already
closed, there's no need to log an error.

This patch adds a `closed` boolean to check if the
file was closed, and if so, skip closing the file.
This prevents errors like this being logged:

    level=error msg="Error closing logger: invalid argument"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-05-29 17:42:37 +02:00
YAMASAKI Masahide
524f306340 Improved poor memory efficiency of awslogs
Signed-off-by: YAMASAKI Masahide <masahide.y@gmail.com>
2017-05-18 23:30:00 +09:00
gkze
d42c268fc3 GCP Logs: send log line as jsonPayload.message instead of jsonPayload.data
Signed-off-by: gkze <george@bugsnag.com>
2017-05-15 16:35:53 -07:00
Justin Menga
dc87490b63 Update comments describing new behaviour
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-15 11:08:16 +12:00
Justin Menga
3a4cf2b076 Code review changes
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-15 10:28:18 +12:00
Justin Menga
bf1c377f60 Add missing month in datetime map
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-13 22:10:51 +12:00
Justin Menga
4374f16667 Append new line to multiline events
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-13 17:54:04 +12:00
Justin Menga
8ef9c19ecd Code review changes
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-13 17:54:04 +12:00
Tibor Vass
f775005a17 awslogs: use github.com/pkg/errors to wrap an error
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-13 17:54:04 +12:00
Justin Menga
6f073e3522 Formatting
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-13 17:54:04 +12:00
Justin Menga
84b03660da Add awslogs benchmarks
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-13 17:54:04 +12:00
Justin Menga
ab74038df9 Add awslogs multiline support
Signed-off-by: Justin Menga <justin.menga@gmail.com>
2017-05-13 17:54:04 +12:00
Grzegorz Jaśkiewicz
d925e50470 gcplogging driver MRPB set
Signed-off-by: Grzegorz Jaśkiewicz <gj.jaskiewicz@gmail.com>
2017-05-09 14:24:43 +02:00
Tõnis Tiigi
5eca7f7c5d Merge pull request #31856 from jim-minter/more_races
Resolve a set of race conditions in logging and attaching code
2017-04-26 16:04:02 -07:00
Jim Minter
4fdb17c777 Prevent ContainerLogs from hanging if container doesn't run for long
Signed-off-by: Jim Minter <jminter@redhat.com>
2017-04-20 12:27:51 +01:00
Brian Goff
17abacb894 Add logdrivers to /info
This is required for swarmkit to be able to filter based on log driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-04-11 18:07:15 -04:00
Brian Goff
27bd6842f8 Implement plugins for logging drivers
Logging plugins use the same HTTP interface as other plugins for basic
command operations meanwhile actual logging operations are handled (on
Unix) via a fifo.

The plugin interface looks like so:

```go
type loggingPlugin interface {
  StartLogging(fifoPath string, loggingContext Context) error
  StopLogging(fifoPath)
```

This means a plugin must implement `LoggingDriver.StartLogging` and
`LoggingDriver.StopLogging` endpoints and be able to consume the passed
in fifo.

Logs are sent via stream encoder to the fifo encoded with protobuf.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-04-10 13:17:20 -04:00
Drew Erny
1044093bb0 refactor logs and support service logs /w tty
Refactor container logs system to make communicating log messages
internally much simpler. Move responsibility for marshalling log
messages into the REST server. Support TTY logs. Pave the way for fixing
the ambiguous bytestream format. Pave the way for fixing details.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-04-06 17:54:11 -07:00
Brian Goff
1325f667ee Merge pull request #27565 from rothrock/env-by-regex
[splunk] Use a regex to match environment variables
2017-03-31 10:46:48 -04:00
Sebastiaan van Stijn
57fd478169 Merge pull request #31083 from xulike666/fight-for-readability
fix some typos from module contrib to man
2017-03-03 15:13:01 +01:00
Akihiro Suda
a6576b8a2b Merge pull request #31212 from fate-grand-order/fixed
use t.Fatal() to output the err message and fix typo
2017-02-27 12:26:35 +09:00
fate-grand-order
2a8d6368d4 use t.Fatal() to output the err message where the values used for formatting
text does not appear to contain a placeholder

Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
2017-02-23 10:16:22 +08:00
Alexander Morozov
b3e7f70137 Merge pull request #31263 from nalind/journal-doublefree
Synchronize the cursor returned by followJournal
2017-02-22 17:45:49 -08:00
Nalin Dahyabhai
d57c330617 Synchronize the cursor returned by followJournal
Make sure that the cursor value returned by followJournal() is the last
of the values returned by its goroutine's calls to drainJournal() by
waiting for it, rather than returning a value that may be superceded by
another if we're singalling the goroutine that it should exit by closing
a pipe.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-22 16:22:00 -05:00
Kenfe-Mickael Laventure
81630df854 Prevent freeing a possible invalid pointer from journald
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-22 07:54:10 -08:00
Aaron.L.Xu
e0577d5fe8 fix some typos from module contrib to man
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-02-18 10:08:55 +08:00
Brian Goff
7a179972ff Fix cpu spin waiting for log write events
This loop is not ever going to return since it's never actually setting
the `err` var except on the first iteration.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-02-15 21:41:32 -05:00
Vincent Demeester
14790e4008 Merge pull request #30694 from godefroi/26937-fix-rfc5424-log-format-1
Add NILVALUE for STRUCTURED-DATA in RFC5424 logs
2017-02-07 23:22:39 +01:00
Alexander Morozov
d38753303a Merge pull request #30136 from tg123/master
Windows: return err instead of panic when convert string to utf16
2017-02-06 14:00:00 -08:00
Mark Parker
b7d802bbcc 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>
2017-02-02 15:16:14 -07:00
Brian Goff
3f4fccb65f 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>
2017-02-01 13:52:37 -05:00
Brian Goff
054abff3b6 Implement optional ring buffer for container logs
This allows the user to set a logging mode to "blocking" (default), or
"non-blocking", which uses the ring buffer as a proxy to the real log
driver.

This allows a container to never be blocked on stdio at the cost of
dropping log messages.

Introduces 2 new log-opts that works for all drivers, `log-mode` and
`log-size`. `log-mode` takes a  value of "blocking", or "non-blocking"
I chose not to implement this as a bool since it is difficult to
determine if the mode was set to false vs just not set... especially
difficult when merging the default daemon config with the container config.
`log-size` takes a size string, e.g. `2MB`, which sets the max size
of the ring buffer. When the max size is reached, it will start
dropping log messages.

```
BenchmarkRingLoggerThroughputNoReceiver-8           	2000000000	        36.2 ns/op	 856.35 MB/s	       0 B/op	       0 allocs/op
BenchmarkRingLoggerThroughputWithReceiverDelay0-8   	300000000	       156 ns/op	 198.48 MB/s	      32 B/op	       0 allocs/op
BenchmarkRingLoggerThroughputConsumeDelay1-8        	2000000000	        36.1 ns/op	 857.80 MB/s	       0 B/op	       0 allocs/op
BenchmarkRingLoggerThroughputConsumeDelay10-8       	1000000000	        36.2 ns/op	 856.53 MB/s	       0 B/op	       0 allocs/op
BenchmarkRingLoggerThroughputConsumeDelay50-8       	2000000000	        34.7 ns/op	 894.65 MB/s	       0 B/op	       0 allocs/op
BenchmarkRingLoggerThroughputConsumeDelay100-8      	2000000000	        35.1 ns/op	 883.91 MB/s	       0 B/op	       0 allocs/op
BenchmarkRingLoggerThroughputConsumeDelay300-8      	1000000000	        35.9 ns/op	 863.90 MB/s	       0 B/op	       0 allocs/op
BenchmarkRingLoggerThroughputConsumeDelay500-8      	2000000000	        35.8 ns/op	 866.88 MB/s	       0 B/op	       0 allocs/op
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-02-01 13:52:37 -05:00
Alexander Morozov
dc78b3a1d4 Merge pull request #29863 from ncdc/journald-logdriver-drain-one-more-time-after-follow-ends
journald logs: drain 1 more time at container exit
2017-02-01 10:30:14 -08:00
Yong Tang
864b0c2e47 Support of CreateLogGroup for awslogs
This fix tries to address the issue raised in 29344 where it was
not possible to create log group for awslogs (CloudWatch) on-demand.
Log group has to be created explicitly before container is running.

This behavior is inconsistent with AWS logs agent where log groups
are always created as needed.

There were several concerns previously (See comments in 19617 and 29344):
1. There is a limit of 500 log groups/account/region so resource might
be exhausted if there is any typo or incorrect region.
2. Logs are generated for every container so CreateLogGroup (or equally,
DescribeLogGroups) might be called every time, which is redundant and
potentially surprising.
3. CreateLogStream and CreateLogGroup have different IAM policies.

This fix addresses the issue by add `--log-opt awslogs-create-group`
which by default is `false`. It requires user to explicitly request
that log groups be created as needed.

Related unit test has been updated. And tests have also been done
manually in AWS.

This fix fixes 29334.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-27 11:15:17 -08:00
Andy Goldstein
76f58d7294 journald logs: drain 1 more time at container exit
In the journald log driver, attempt to drain the journal 1 more time
after being told to stop following the log. Due to a possible race
condition, sometimes data is written to the journal at almost the same
time the log watch is closed, and depending on the order of operations,
sometimes you miss the last journal entry.

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
2017-01-25 09:29:21 -05:00
Joseph Rothrock
9758a2a724 Use a regex to match environment variables #27565
Signed-off-by: Joseph Rothrock <rothrock@rothrock.org>
2017-01-19 15:30:11 -08:00
Kenfe-Mickael Laventure
fb2bb3653e Close logwatcher on context cancellation
This commit addresses 2 issues:

  1. in `tailfile()` if somehow the `logWatcher.Msg` were to become full and the watcher closed before space was made into it, we were getting stuck there forever since we were not checking for the watcher getting closed
  2. when servicing `docker logs`, if the command was cancelled we were not closing the watcher (and hence notifying it to stop copying data)

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-17 14:36:13 -08:00
Boshi Lian
1c770c6d8c return err instead of panic when convert string to utf16
Signed-off-by: Boshi Lian <farmer1992@gmail.com>
2017-01-14 02:21:22 +08:00
yupengzte
230b7c2e4c fix syscall.GUID composite literal uses unkeyed fields
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-01-03 17:12:15 +08:00
Sebastiaan van Stijn
a331056268 Merge pull request #28852 from miaoyq/rename-log-context
Rename 'context' to 'loginfo' in the logger module
2016-12-30 01:13:49 +01:00
Yanqiang Miao
17ec911da7 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>
2016-12-29 19:13:44 +08:00
Akihiro Suda
b86e3bee5a gcplogs: forcibly set HOME on static UNIX binary
Fix #29344

If HOME is not set, the gcplogs logging driver will call os/user.Current() via oauth2/google.
However, in static binary, os/user.Current() leads to segfault due to a glibc issue that won't be fixed
in a short term. (golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341)
So we forcibly set HOME so as to avoid call to os/user/Current().

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-12-29 03:17:26 +00:00
Brian Goff
b0aab6e83e Merge pull request #29475 from AkihiroSuda/vendor-oauth2-3
Vendor gcplogs deps
2016-12-28 11:55:03 -05:00
Sebastiaan van Stijn
b9ee31ae02 Merge pull request #29314 from vdemeester/no-more-utils
Remove the utils package
2016-12-22 15:21:05 +01:00
Sebastiaan van Stijn
05dc9846e1
remove client-side for supported logging drivers
The `docker logs` command performed a
client-side check if the container's
logging driver was supported.

Now that we allow the client to connect
to both "older" and "newer" daemon versions,
this check is best done daemon-side.

This patch remove the check on the client
side, and leaves validation to the daemon,
which should be the source of truth.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-19 14:30:01 +01:00
Akihiro Suda
ff2f875574 vendor: google.golang.org/cloud -> cloud.google.com/go
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-12-16 08:36:18 +00:00
unclejack
3a42518042 daemon: return directly without ifs where possible
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2016-12-14 22:36:58 +02:00
Vincent Demeester
04f7a03359
Move templates to pkg/templates
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-12 09:34:03 +01:00
Alexander Morozov
6151ad19ad Merge pull request #28797 from miaoyq/fix-a-err-of-logger
Fix a error of the function 'CopyMessage' in 'daemon/logger/logger.go'
2016-11-30 13:27:40 -08:00
Antonio Murdaca
022c13271b Merge pull request #28829 from lixiaobing10051267/masterDaemon
check typos and fix in daemon directory
2016-11-26 14:33:09 +01:00
lixiaobing10051267
cf4f5b4771 check typos and fix in daemon directory
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>

Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
2016-11-26 17:23:21 +08:00
Yanqiang Miao
3b82eac65f Fix a error of the function 'CopyMessage' in 'daemon/logger/logger.go'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

add a test for 'CopyMessage'

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

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2016-11-24 20:08:54 +08:00
Yanqiang Miao
52fd6e4664 Optimize the function 'Context.Name()' and replace 'Context.ContainerName' that need to remove slash with 'Context.Name()'.
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

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

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2016-11-24 09:24:29 +08:00
Darren Stahl
22c83c567f Swap usage of LazyDLL and LoadDLL to LazySystemDLL.
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-11-22 14:57:11 -08:00
lixiaobing10051267
320c93824b function TestCreateSuccess uses a wrong variable LogGroupName
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
2016-11-16 16:48:36 +08:00
Sebastiaan van Stijn
806f09bf32 Merge pull request #26088 from akirakoyasu/patch-fluent-unixsocket
Proposal: unix-sockets support in Fluentd logging driver
2016-11-09 12:49:06 +01:00
Silvan Jegen
d359daaa48 Clean up journald logger
We clean up the journald logger with these four changes.

1. Make field array static
2. Make function name more appropriate
3. Initialize the file descriptors only once
4. Avoid copying the journald cursor

Point 4 is the most significant change: instead of treating the journald
cursor like a Go string we use it as a raw C.char pointer. That way we
avoid the copying by the C.CString and C.GoString functions.

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
2016-11-08 19:09:59 +01:00
Vincent Demeester
9f7cc7d032 Merge pull request #28035 from thaJeztah/add-test-for-long-loglines
add tests for long log-lines and trailing lines
2016-11-04 07:59:20 +01:00
Alexander Morozov
c072347078 Merge pull request #27912 from LK4D4/vndr
project: use vndr for vendoring
2016-11-03 18:30:19 -07:00
Alexander Morozov
f2614f2107 project: use vndr for vendoring
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-11-03 15:31:46 -07:00
French Ben
3661510f7f Updated AWS logstream to understand tags
Signed-off-by: French Ben <frenchben@docker.com>
2016-11-03 13:49:40 -07:00
Sebastiaan van Stijn
ee34dd9f8a
add tests for long log-lines and trailing lines
this adds new tests to test logging of long log-lines
(without newlines), and trailing log-lines.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-11-03 10:01:00 -07:00
milindchawre
3463bbcc71 Fixes #21803 : Removing unused configuration in daemon/logger/fluentd
Signed-off-by: milindchawre <milindchawre@gmail.com>
2016-11-02 11:11:02 +00:00
Tom Booth
a69a59ffc7 Decouple removing the fileWatcher from reading
Fixes #27779

Currently `followLogs` can get into a deadlock if we receive an inotify
IN_MODIFY event while we are trying to close the `fileWatcher`. This is
due to the fact that closing the `fileWatcher` happens in the same block
as consumes events from the `fileWatcher`. We are trying to run
`fileWatcher.Close`, which is waiting for an IN_IGNORE event to come in
over inotify to confirm the watch was been removed. But, because an
IN_MODIFY event has appeared after `Close` was entered but before the
IN_IGNORE, the broadcast never comes. The IN_MODIFY cannot be consumed
as the events channel is unbuffered and the only `select` that reads
from it is busy waiting for the IN_IGNORE event.

In order to try and fix this race condition I've moved the removal of
the `fileWatcher` out to a separate go block that waits for a signal to
close, removes the watcher and then signals to the previous selects on
the close signal.

This has introduced a `fileWatcher.Remove` in the final case, but if we
try and remove a watcher that does not exist it will just return an
error saying so. We are not doing any checking on the return of `Remove`
so this shouldn't cause any side-effects.

Signed-off-by: Tom Booth <tombooth@gmail.com>
2016-10-28 10:53:38 +01:00
Tom Booth
6314bec641 Do not directly cast io.ReadSeeker to io.Reader
`golint` had the following issue when linting this file:

```
daemon/logger/jsonfilelog/read.go:116:10: should omit type io.Reader
from declaration of var rdr; it will be inferred from the right-hand
side
```

In order to keep it happy changing it to an indirect assignment will
still maintain the same functionality.

Signed-off-by: Tom Booth <tombooth@gmail.com>
2016-10-26 17:37:48 +01:00
Akira Koyasu
cb176c848e add scheme to fluentd-address
Signed-off-by: Akira Koyasu <mail@akirakoyasu.net>

- add scheme to fluentd-address
- define a new type `location`
- use `errors.Wrapf`
2016-10-26 03:36:51 +09:00
Sebastiaan van Stijn
24582e8153 Merge pull request #27471 from caarlos0/logentries
Added Logentries Driver
2016-10-18 01:33:28 -07:00
Elena Morozova
64238fef8c all: replace loop with single append
Signed-off-by: Elena Morozova <lelenanam@gmail.com>
2016-10-13 13:31:52 -07:00
Carlos Alexandro Becker
2764d67c3a
added logentries driver
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2016-10-06 22:48:53 -03:00
Michael Crosby
efe4e914ef Merge pull request #26207 from splunk/splunk-logging-driver-performance-improvements
Splunk Logging Driver performance improvements
2016-09-16 10:22:09 -07:00
Denis Gladkikh
4907cc7793 Splunk Logging Driver performance improvements
New driver options:

- `splunk-gzip` - gzip compress all requests to Splunk HEC
(enabled by default)
- `splunk-gzip-level` - change compression level.

Messages are sent in batches by 1000, with frequency of 5 seconds.
Maximum buffer is 10,000 events. If HEC will not be available, Splunk
Logging Driver will keep retrying while it can hold messages in buffer.

Added unit tests for driver.

Signed-off-by: Denis Gladkikh <denis@gladkikh.email>
2016-09-12 09:00:16 -07:00
Sven Dowideit
5be6ccc433 Merge pull request #24586 from farcaller/gcplogs
Added optional flags to init gcp logger metadata
2016-09-08 13:47:48 +10:00
Brian Goff
2c91c5fdad Merge pull request #25736 from mwieczorek/25689-enable-syslog-driver-on-windows
Enable syslog driver for windows
2016-08-29 17:46:12 -04:00
Aaron Lehmann
cbd4e4d48a Merge pull request #24514 from cpuguy83/fix_log_follow_rotate
Fix issues with tailing rotated jsonlog file
2016-08-26 09:47:40 -07:00
Brian Goff
15f3d060ac Merge pull request #24153 from frodenas/syslog-fix
Syslog Driver: RFC 5425 Message Framing should be used only when protocol is TCP+TLS
2016-08-25 12:15:06 -04:00
Denis Gladkikh
9407322972 Splunk Logging Driver: PR feedback
Signed-off-by: Denis Gladkikh <denis@gladkikh.email>
2016-08-18 09:17:06 -07:00
Michal Wieczorek
eac70703e3 Enable syslog driver for windows
Signed-off-by: Michal Wieczorek <wieczorek-michal@wp.pl>
2016-08-17 22:26:24 +02:00
Denis Gladkikh
603fd08315 Splunk Logging Driver: formats and verifyconnection
`--log-opt splunk-format=inline|json|raw` allows to change how logging
driver sends data to Splunk, where

`inline` - default value, format used before, message is injected as a
line in JSON payload
`json` - driver will try to parse each line as a JSON object and embed it
inside of the JSON payload
`raw` - driver will send Raw payload instead of JSON, tag and attributes
will be prefixed before the message

`--log-opt splunk-verify-connection=true|false` - allows to skip
verification for Splunk Url

Signed-off-by: Denis Gladkikh <denis@gladkikh.email>
2016-08-16 21:45:16 -07:00
Brian Goff
84e60a7e10 Fix issues with tailing rotated jsonlog file
Fixes a race where the log reader would get events for both an actual
rotation as we from fsnotify (`fsnotify.Rename`).
This issue becomes extremely apparent when rotations are fast, for
example:

```
$ docker run -d --name test --log-opt max-size=1 --log-opt max-file=2
busybox sh -c 'while true; do echo hello; usleep 100000; done'
```

With this change the log reader for jsonlogs can handle rotations that
happen as above.

Instead of listening for both fs events AND rotation events
simultaneously, potentially meaning we see 2 rotations for only a single
rotation due to channel buffering, only listen for fs events (like
`Rename`) and then wait to be notified about rotation by the logger.
This makes sure that we don't see 2 rotations for 1, and that we don't
start trying to read until the logger is actually ready for us to.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-08-15 13:57:28 -04:00
Brian Goff
c6e3818dd1 Merge pull request #24814 from samuelkarp/awslogs
awslogs: Record log line insert order for sorting
2016-08-12 15:51:06 -04:00
allencloud
0ead624473 add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-08-10 08:36:09 +08:00
Yong Tang
9528ea930c Sanitize docker labels when used as journald field names
This fix tries to address the issue raised in #23528 where
docker labels caused journald log error because journald
has special requirements on field names.

This fix addresses this issue by sanitize the labels per
requirements of journald.

Additional unit tests have been added to cover the changes.

This fix fixes #23528.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-08-05 15:20:47 -07:00
Samuel Karp
443f251cf5 awslogs: Record log line insert order for sorting
Fixes https://github.com/docker/docker/issues/24775

Signed-off-by: Samuel Karp <skarp@amazon.com>
2016-08-03 10:04:20 -07:00
Samuel Karp
5ba6cab0a9 awslogs: Add unit test to ensure log line order
Signed-off-by: Samuel Karp <skarp@amazon.com>
2016-08-03 10:01:12 -07:00
Sebastiaan van Stijn
48569e0a35 Merge pull request #22911 from vdemeester/20033-default-logging-tag-value
Standardize default logging tag value
2016-07-29 02:18:57 +02:00
Alexander Morozov
e43033bc23 Merge pull request #22982 from nalind/log-newlines
Improve logging of long log lines
2016-07-28 16:41:01 -07:00
Vladimir Pouzanov
71f2999764 Added optional flags to init gcp logger metadata
Signed-off-by: Vladimir Pouzanov <farcaller@google.com>
2016-07-13 13:56:18 +01:00
Ferran Rodenas
4039bfc917 Syslog Driver: RFC 5425 Framing should be used only when protocol is TCP+TLS
Signed-off-by: Ferran Rodenas <frodenas@gmail.com>
2016-06-29 15:41:10 -07:00
Alexander Morozov
378f0657f9 daemon/logger: fix races in channel close
it's actually not okay to do such trick from multiple goroutines

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-06-27 14:14:23 -07:00
Stefan J. Wernli
54f11b84d2 Fixing file handle leak for "docker logs"
If "docker logs" was used on an offline container, the logger is leaked, leaving it up to the finalizer to close the file handle, which could block removal of the container.  Further, the json file logger could leak an open handle if the logs are read without follow due to an early return without a close.  This change addresses both cases.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-06-21 18:40:30 -07:00
Nalin Dahyabhai
513ec73831 Improve logging of long log lines
This change updates how we handle long lines of output from the
container.  The previous logic used a bufio reader to read entire lines
of output from the container through an intermediate BytesPipe, and that
allowed the container to cause dockerd to consume an unconstrained
amount of memory as it attempted to collect a whole line of output, by
outputting data without newlines.

To avoid that, we replace the bufio reader with our own buffering scheme
that handles log lines up to 16k in length, breaking up anything longer
than that into multiple chunks.  If we can dispense with noting this
detail properly at the end of output, we can switch from using
ReadBytes() to using ReadLine() instead.  We add a field ("Partial") to
the log message structure to flag when we pass data to the log driver
that did not end with a newline.

The Line member of Message structures that we pass to log drivers is now
a slice into data which can be overwritten between calls to the log
driver's Log() method, so drivers which batch up Messages before
processing them need to take additional care: we add a function
(logger.CopyMessage()) that can be used to create a deep copy of a
Message structure, and modify the awslogs driver to use it.

We update the jsonfile log driver to append a "\n" to the data that it
logs to disk only when the Partial flag is false (it previously did so
unconditionally), to make its "logs" output correctly reproduce the data
as we received it.

Likewise, we modify the journald log driver to add a data field with
value CONTAINER_PARTIAL_MESSAGE=true to entries when the Partial flag is
true, and update its "logs" reader to refrain from appending a "\n" to
the data that it retrieves if it does not see this field/value pair (it
also previously did this unconditionally).

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
2016-06-14 14:11:47 -04:00
Nalin Dahyabhai
af439c7a8d Add a benchmark for logger.Copier
Add a benchmark for measuring how the logger.Copier implementation
handles logged lines of sizes ranging up from 64 bytes to 256KB.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-06-09 09:47:13 -04:00
Brian Goff
3f970819bb Merge pull request #23063 from yongtang/22961-aws-sdk-go
Update aws-sdk-go to v1.1.30
2016-06-05 16:01:52 -04:00
Vincent Demeester
f900e1cf47
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>
2016-06-04 12:38:12 +02:00
Sven Dowideit
98c245c9e6 Merge pull request #23193 from allencloud/fix-typos
use grep to find all a/an typos
2016-06-02 18:45:08 -07:00
Nalin Dahyabhai
0da0a8f9da Add support for reading journal extras and in UTC
When told to read additional attributes from logs that we've sent to the
journal, pull out all of the non-trusted, non-user fields that we didn't
hard-code ourselves.  More of PR#20726 and PR#21889.

When reading entries in the journald log reader, set the time zone on
timestamps that we read to UTC, so that we send UTC values to the client
instead of values that are local to whatever timezone dockerd happens to
be running in.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
2016-06-02 10:17:07 -04:00
allencloud
c1be45fa38 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-06-02 17:17:22 +08:00
Akihiro Suda
518709a87e Fix the comment for daemon/logger.Copier
Now daemon/logger.Copier does not use ContainerID

Addendum to #23141

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-06-02 13:10:51 +09:00
Nalin Dahyabhai
7772d270c0 Remove the logger.Message ContainerID field
Log drivers are instantiated on a per-container basis, and passed the
container ID (along with other information) when they're initialized.
Drivers that care about that value are caching the value that they're
passed when they're initialized and using it in favor of the value
contained in Message structures that are passed to them, so the field in
Messages is unused, so we remove it.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-05-31 16:41:29 -04:00
Sebastiaan van Stijn
f3a7abee81 Merge pull request #22384 from yongtang/22358-log-tag-prefix
Remove `docker/` prefix from log messages tag.
2016-05-30 14:48:31 +02:00
Yong Tang
46ea8ff75d Fix build errors caused by update aws-sdk-go to v1.1.30
This fix tries to fix build errors caused by updating
aws-sdk-go to v1.1.30.

This fix fixes #22961.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-05-28 18:49:17 -07:00
Samuel Karp
c1ad02ccc8 awslogs: Fix a race in mockcwlogsclient
Signed-off-by: Samuel Karp <skarp@amazon.com>
2016-05-25 11:50:22 -07:00
Akihiro Suda
ab533f0651 Fix a race in daemon/logger.TestCopier
Update #22963

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-05-25 05:07:24 +00:00
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
bd9d14a07b Add support for reading logs extra attrs
The jsonlog logger currently allows specifying envs and labels that
should be propagated to the log message, however there has been no way
to read that back.

This adds a new API option to enable inserting these attrs back to the
log reader.

With timestamps, this looks like so:
```
92016-04-08T15:28:09.835913720Z foo=bar,hello=world hello
```

The extra attrs are comma separated before the log message but after
timestamps.

Without timestaps it looks like so:
```
foo=bar,hello=world hello
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-05-06 20:42:20 -04:00
Shijiang Wei
1790980ec6 inherit the daemon log options when creating containers
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-05-02 23:04:04 +08: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
Alexander Morozov
b9966f3a81 daemon: remove some unused code
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-03-31 11:24:12 -07:00
Vincent Demeester
e6f2429e01 Merge pull request #21607 from allencloud/change-validateNoSchema-to-validateNoScheme
change validateNoSchema to validateNoScheme
2016-03-31 10:14:23 +02:00
allencloud
28d3c22e55 1.change validateNoSchema into validateNoScheme
2.change schema into scheme in docs and some annotations.

Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-03-31 12:29:15 +08:00
Nalin Dahyabhai
ab62ecf393 Open the journald following descriptor earlier
Following a journal log almost always requires a descriptor to be
allocated.  In cases where we're running out of descriptors, this means
we might get stuck while attempting to start following the journal, at a
point where it's too late to report it to the client and clean up
easily.  The journal reading context will cache the value once it's
allocated, so here we move the check earlier, so that we can detect a
problem when we can still report it cleanly.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-03-24 10:12:51 -04:00
Nalin Dahyabhai
8d597d25a8 Improve error reporting when following journals
When we set up to start following a journal, if we get error results
from sd_journal_get_fd() or sd_journal_get_events() that prevent us from
following the journal, report the error instead of just mysteriously
failing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
2016-03-24 10:12:15 -04:00
Alexander Morozov
11b4c89087 Merge pull request #21301 from cpuguy83/cleaner_file_log
Fixes some issues with jsonfile write/read
2016-03-21 14:03:36 -07:00
Brian Goff
1ae9dcf97d Fixes some issues with jsonfile write/read
This cleans up some of the use of the filepoller which makes reading
significantly more robust and gives fewer changes to fallback to the
polling based watcher.
In a lot of cases, if the file was being rotated while we were adding it
to the watcher, it would return an error that the file doesn't exist and
would fallback.
In some cases this fallback could be triggered multiple times even if we
were already on the fallback/poll-based watcher.

It also fixes an open file leak caused by not closing files properly on
rotate, as well as not closing files that were read via the `tail`
function until after the log reader is completed.

Prior to the above changes, it was relatively simple to cause the log
reader to error out by having quick rotations, for example:
```
$ docker run --name test --log-opt max-size=10b --log-opt max-files=10
-d busybox sh -c 'while true; do usleep 500000; echo hello; done'
$ docker logs -f test
```
After these changes I can run this forever without error.

Another fix removes 2 `os.Stat` calls when rotating files. The stat
calls are not needed since we are just calling `os.Rename` anyway, which
will in turn also just produce the same error that `Stat` would.
These `Stat` calls were also quite expensive.
Removing these stat calls also seemed to resolve an issue causing slow
memory growth on the daemon.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-03-21 11:05:58 -04:00
Pierre Carrier
13086f387b fluentd logger: support all options besides Unix sockets
Mostly useful for docker/docker#19438.

Signed-off-by: Pierre Carrier <pierre@meteor.com>
2016-03-21 10:03:21 +00:00
Pierre Carrier
d89dae6e4b Revert "Added flag to ignore fluentd connect error on container start"
This reverts commit 3cf82ff1ab.

Signed-off-by: Pierre Carrier <pierre@meteor.com>
2016-03-20 16:22:19 +00:00
Nalin Dahyabhai
52c0f36f7b Fix a race in cleaning up after journald followers
When following a journal-based log, it was possible for the worker
goroutine, which reads the journal using the journal context and sends
entry data down the message channel, to be scheduled after the function
which started it had returned.  This could create problems, since the
invoking function was closing the journal context object and message
channel before it returned, which could trigger use-after-free segfaults
and write-to-closed-channel panics in the worker goroutine.

Make the cleanup in the invoking function conditional so that it's only
done when we're not following the logs, and if we are, that it's left to
the worker goroutine to close them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
2016-03-17 18:36:21 -04:00
Nalin Dahyabhai
4d200cd693 Fix a race in maintaining the journald reader list
The journald log reader keeps a map of following readers so that it can
close them properly when the journald reader object itself is closed,
but it was possible for its worker goroutine to be scheduled so that the
worker attempted to remove a reader from the map before the reader had
been added to the map.  This patch adds the item to the map before
starting the goroutine which is expected to eventually remove it.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
2016-03-17 18:36:21 -04:00
Michael Crosby
2b9ceea896 Merge pull request #21293 from cpuguy83/wtf_gcp
Do not call out to Google on init
2016-03-17 10:32:21 -07:00
Alexander Morozov
04c7d94c71 Merge pull request #21273 from jfrazelle/remove-dead-code
remove dead code
2016-03-17 09:16:02 -07:00
Brian Goff
24710fd3e2 Do not call out to Google on init
The GCP logging driver is calling out to GCP cloud service on package
init.
This is regardless if you are using GCP logging or not.

This change makes this happen on the first invocation of a new GCP
logging driver instance instead.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-03-17 11:06:21 -04:00
Jessica Frazelle
8dd88afb5b
remove dead code
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-03-16 19:15:14 -07:00
Antonio Murdaca
f0d83c4cdb *: fix response body leaks
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-03-16 17:15:42 +01:00
Antonio Murdaca
0f59b0b12c Merge pull request #19831 from cloudflare/optimize-gelf
GELF logger: Add gelf-compression-type and gelf-compression-level
2016-03-15 22:35:46 +01:00
Daniel Dao
bd94baa353 add gelf option to customize compression type and level
this allows user to choose the compression type (i.e. gzip/zlib/none) using
--log-opt=gelf-compression-type=none or the compression level (-1..9) using
--log-opt=gelf-compression-level=0 for gelf driver.

Signed-off-by: Daniel Dao <dqminh@cloudflare.com>
2016-03-15 11:06:06 +00:00
Brian Goff
f500951598 Merge pull request #20121 from solganik/master
syslog format
2016-03-14 20:09:15 -04:00
David Calavera
8514880997 Provide basic string manupilation functions for template executions.
This change centralizes the template manipulation in a single package
and adds basic string functions to their execution.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-09 19:37:12 -05: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
Sebastiaan van Stijn
3c4d093bab Merge pull request #18766 from mikedanese/gcplogs
Add logging driver for Google Cloud Logging
2016-03-02 02:09:44 +01:00
Arnaud Porterie
106793dcbe Merge pull request #20825 from LK4D4/unused
Remove some unused structs and fields
2016-03-01 12:58:35 -08:00
Tibor Vass
36401f20ce Merge pull request #20617 from nalind/journald-pkgconfig
Try to handle changing names for journal packages
2016-03-01 15:38:03 -05:00
Alexander Morozov
0a352e1a90 Remove some unused structs and fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-03-01 09:59:29 -08:00
Mike Danese
ed1b9fa07a daemon/logger: Add logging driver for Google Cloud Logging
Signed-off-by: Mike Danese <mikedanese@google.com>
2016-03-01 08:06:10 -08:00
David Calavera
ba5a282a83 Merge pull request #20605 from mountkin/optimize-json-log-writer
make the json log writer much faster
2016-02-29 10:47:46 -08:00
Brian Goff
f9524a4d24 add file poller panic fix from 1.10.2
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-24 10:17:29 -05:00
Brian Goff
91fdfdd537 Revert "use pubsub instead of filenotify to follow json logs"
This reverts commit b1594c59f5.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-23 21:43:52 -05:00
Nalin Dahyabhai
6cdc4ba6cd Try to handle changing names for journal packages
When checking if we have the development files for libsystemd's journal
APIs, check for either 'libsystemd >= 209' and 'libsystemd-journal'.  If
we find 'libsystemd', define the 'journald' tag, which defaults to using
the 'libsystemd.pc' file.  If we find the older 'libsystemd-journal',
define both the 'journald' and 'journald_compat' tags, which causes the
'libsystemd-journal.pc' file to be consulted instead.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
2016-02-23 12:24:27 -05:00
Shijiang Wei
d7af031114 make the json log writer much faster
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-02-23 19:28:06 +08:00
David Calavera
c795d0bab9 Merge pull request #19689 from cednation/etwlogs
Windows: Add ETW logging driver plug-in
2016-02-16 15:01:17 -08:00
Cedric Davies
3fe60bbf95 Windows: Add ETW logging driver plug-in
Signed-off-by: Cedric Davies <cedricda@microsoft.com>
2016-02-16 13:24:49 -08:00
Shijiang Wei
b1594c59f5 use pubsub instead of filenotify to follow json logs
inotify event is trigged immediately there's data written to disk.
But at the time that the inotify event is received, the json line might
not fully saved to disk. If the json decoder tries to decode in such
case, an io.UnexpectedEOF will be trigged.
We used to retry for several times to mitigate the io.UnexpectedEOF error.
But there are still flaky tests caused by the partial log entries.

The daemon knows exactly when there are new log entries emitted. We can
use the pubsub package to notify all the log readers instead of inotify.

Signed-off-by: Shijiang Wei <mountkin@gmail.com>

try to fix broken test. will squash once tests pass

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2016-02-15 19:25:16 +08:00
David Calavera
7a016578db Merge pull request #18041 from jnummelin/feature/fluent-logger-ignore-connect-error-flag
Added flag to ignore fluentd connect error on container start
2016-01-27 14:25:24 -08:00
Ivan Babrou
5a3351883b Add tag support to journald logging driver, closes #19556
Signed-off-by: Ivan Babrou <ibobrik@gmail.com>
2016-01-27 10:52:19 +00:00
Jussi Nummelin
3cf82ff1ab Added flag to ignore fluentd connect error on container start
Signed-off-by: Jussi Nummelin <jussi.nummelin@gmail.com>

Changed buffer size to 1M and removed unnecessary fmt call

Signed-off-by: Jussi Nummelin <jussi.nummelin@gmail.com>

Updated docs for the new fluentd opts

Signed-off-by: Jussi Nummelin <jussi.nummelin@gmail.com>
2016-01-27 09:05:44 +02:00
Daniel Dao
84e14754e1 only close LogDriver after LogCopier is done
this prevents the copier from sending messages in the buffer to the closed
driver. If the copied took longer than the timeout to drain the buffer, this
aborts the copier read loop and return back so we can cleanup resources
properly.

Signed-off-by: Daniel Dao <dqminh@cloudflare.com>
2016-01-18 17:47:57 +00: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
Ingo Gottwald
f8c5420080 Fix race condition in JSONFileLogger.Log
Signed-off-by: Ingo Gottwald <in.gottwald@gmail.com>
2016-01-03 22:45:56 +01:00
Doug Davis
6bf8844f11 Merge pull request #18759 from mikedanese/doc-fix
daemon/logger: fix typo in godoc
2015-12-17 19:26:41 -05:00
Mike Danese
881a30c707 daemon/logger: fix typo in godoc
Signed-off-by: Mike Danese <mikedanese@google.com>
2015-12-17 15:52:33 -08:00