Commit Graph

180 Commits

Author SHA1 Message Date
bb58024492 Merge pull request #28797 from miaoyq/fix-a-err-of-logger
Fix a error of the function 'CopyMessage' in 'daemon/logger/logger.go'
Upstream-commit: 6151ad19ad2a5cd2ec2c3afc08ed07f64623ae36
Component: engine
2016-11-30 13:27:40 -08:00
2f9e7efdc3 Merge pull request #28829 from lixiaobing10051267/masterDaemon
check typos and fix in daemon directory
Upstream-commit: 022c13271b274074a6190952f1888b01c13c4a7c
Component: engine
2016-11-26 14:33:09 +01:00
115737bff2 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>
Upstream-commit: cf4f5b47710b3875767f997fc2eb3386cb0b66c0
Component: engine
2016-11-26 17:23:21 +08:00
c3ca7189dc 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>
Upstream-commit: 3b82eac65fc365a89f64ccaba98f8f3b5c9c5787
Component: engine
2016-11-24 20:08:54 +08:00
475c963e9d 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>
Upstream-commit: 52fd6e46645de098d803bfc510c4c24af1099def
Component: engine
2016-11-24 09:24:29 +08:00
4d1ac89cc0 Swap usage of LazyDLL and LoadDLL to LazySystemDLL.
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 22c83c567f379dfd475ecd35665e1cc9e5b9c314
Component: engine
2016-11-22 14:57:11 -08:00
166b57151d function TestCreateSuccess uses a wrong variable LogGroupName
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: 320c93824b7c4dca3086258264ab142fe4530165
Component: engine
2016-11-16 16:48:36 +08:00
a40c9e3002 Merge pull request #26088 from akirakoyasu/patch-fluent-unixsocket
Proposal: unix-sockets support in Fluentd logging driver
Upstream-commit: 806f09bf32c49cd0493a97522cd809b09b52dfb6
Component: engine
2016-11-09 12:49:06 +01:00
00b0b30b49 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>
Upstream-commit: d359daaa487e68d187cc30c9da8fc08a158c7f79
Component: engine
2016-11-08 19:09:59 +01:00
930e01c1dd Merge pull request #28035 from thaJeztah/add-test-for-long-loglines
add tests for long log-lines and trailing lines
Upstream-commit: 9f7cc7d0320b93236169a7e0f6f9d69fa8c91bb8
Component: engine
2016-11-04 07:59:20 +01:00
7379675f65 Merge pull request #27912 from LK4D4/vndr
project: use vndr for vendoring
Upstream-commit: c07234707878412eaaeab252af19adac8cf25d6b
Component: engine
2016-11-03 18:30:19 -07:00
61646d77af project: use vndr for vendoring
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: f2614f2107c838d014d31b806e3b8a9f1395cb2b
Component: engine
2016-11-03 15:31:46 -07:00
069eefcf38 Updated AWS logstream to understand tags
Signed-off-by: French Ben <frenchben@docker.com>
Upstream-commit: 3661510f7f9f389f25a6d6a065509ae224372994
Component: engine
2016-11-03 13:49:40 -07:00
f08ca94e09 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>
Upstream-commit: ee34dd9f8a8a0246dae94385ed2ca56691085842
Component: engine
2016-11-03 10:01:00 -07:00
a99c149057 Fixes #21803 : Removing unused configuration in daemon/logger/fluentd
Signed-off-by: milindchawre <milindchawre@gmail.com>
Upstream-commit: 3463bbcc710ce56a8d2ace1e2a2aaaf22db3a516
Component: engine
2016-11-02 11:11:02 +00:00
5355683d26 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>
Upstream-commit: a69a59ffc7e3d028a72d1195c2c1535f447eaa84
Component: engine
2016-10-28 10:53:38 +01:00
3b33d2d580 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>
Upstream-commit: 6314bec641b473571c0160d85bdc70250342185a
Component: engine
2016-10-26 17:37:48 +01:00
96c1288dd9 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`
Upstream-commit: cb176c848e0731f77fa48b4e1a90ae74d1f2deae
Component: engine
2016-10-26 03:36:51 +09:00
f3b85d76fb Merge pull request #27471 from caarlos0/logentries
Added Logentries Driver
Upstream-commit: 24582e815330edd197337f17b1a0a541679f969b
Component: engine
2016-10-18 01:33:28 -07:00
4b9781e130 all: replace loop with single append
Signed-off-by: Elena Morozova <lelenanam@gmail.com>
Upstream-commit: 64238fef8c7b739a2ae5648386cf594eb3a162e5
Component: engine
2016-10-13 13:31:52 -07:00
e66a3ee7ff added logentries driver
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
Upstream-commit: 2764d67c3a85cf638e211a1cfb0808e9eba7edb9
Component: engine
2016-10-06 22:48:53 -03:00
fc3c6766ab Merge pull request #26207 from splunk/splunk-logging-driver-performance-improvements
Splunk Logging Driver performance improvements
Upstream-commit: efe4e914efe5f42a5b5e424ed519fda71343f7de
Component: engine
2016-09-16 10:22:09 -07:00
5099b8d2c1 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>
Upstream-commit: 4907cc7793cf469fc2d6fc0f842d08bd045da569
Component: engine
2016-09-12 09:00:16 -07:00
33561ab95c Merge pull request #24586 from farcaller/gcplogs
Added optional flags to init gcp logger metadata
Upstream-commit: 5be6ccc433e8c9207c67087304dfb72fa00ba544
Component: engine
2016-09-08 13:47:48 +10: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
54cfd027ab Merge pull request #24514 from cpuguy83/fix_log_follow_rotate
Fix issues with tailing rotated jsonlog file
Upstream-commit: cbd4e4d48ae2edda79be962f6136c6ae9edad7b9
Component: engine
2016-08-26 09:47:40 -07: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
3029b07f3e Splunk Logging Driver: PR feedback
Signed-off-by: Denis Gladkikh <denis@gladkikh.email>
Upstream-commit: 9407322972a93fa5a47436a8a9f0133b49806e6c
Component: engine
2016-08-18 09:17:06 -07: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
e85d8b261b 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>
Upstream-commit: 603fd0831513257bc26d20ca1f64efcc4965eae6
Component: engine
2016-08-16 21:45:16 -07:00
ab16b6c61a 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>
Upstream-commit: 84e60a7e10278e3acd2b783d0e6955dc5198b57c
Component: engine
2016-08-15 13:57:28 -04:00
05ad7877f1 Merge pull request #24814 from samuelkarp/awslogs
awslogs: Record log line insert order for sorting
Upstream-commit: c6e3818dd11a19b8385e62ed244c0c4e4e75fc89
Component: engine
2016-08-12 15:51:06 -04:00
1c502571ef add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 0ead624473b6bddc232b46bc7c76ab4f9c743ff5
Component: engine
2016-08-10 08:36:09 +08:00
c892df89ab 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>
Upstream-commit: 9528ea930cdb90f906230a6d4cab179001255927
Component: engine
2016-08-05 15:20:47 -07:00
69607140e9 awslogs: Record log line insert order for sorting
Fixes https://github.com/docker/docker/issues/24775

Signed-off-by: Samuel Karp <skarp@amazon.com>
Upstream-commit: 443f251cf596006fe4cb621dcab955f7da0a2a00
Component: engine
2016-08-03 10:04:20 -07:00
7444e549e3 awslogs: Add unit test to ensure log line order
Signed-off-by: Samuel Karp <skarp@amazon.com>
Upstream-commit: 5ba6cab0a9b9e51029fd48858ba6722103356b1a
Component: engine
2016-08-03 10:01:12 -07:00
9b3fd45051 Merge pull request #22911 from vdemeester/20033-default-logging-tag-value
Standardize default logging tag value
Upstream-commit: 48569e0a35934c566b60b99c5c40ac13df517cac
Component: engine
2016-07-29 02:18:57 +02:00
f3d95a7a8f Merge pull request #22982 from nalind/log-newlines
Improve logging of long log lines
Upstream-commit: e43033bc238ce61466c0abe3702878eeeba5e917
Component: engine
2016-07-28 16:41:01 -07:00
866d35843d Added optional flags to init gcp logger metadata
Signed-off-by: Vladimir Pouzanov <farcaller@google.com>
Upstream-commit: 71f299976447a641bacf029a3866fb4bc12a7686
Component: engine
2016-07-13 13:56:18 +01: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
3fd6864743 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>
Upstream-commit: 378f0657f963fa6c854643571e4fe83628466c01
Component: engine
2016-06-27 14:14:23 -07:00
675aa5766a 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>
Upstream-commit: 54f11b84d218c1a7ff4ab4e2148819265da213bc
Component: engine
2016-06-21 18:40:30 -07:00
fb7430591e 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)
Upstream-commit: 513ec73831269947d38a644c278ce3cac36783b2
Component: engine
2016-06-14 14:11:47 -04:00
6942781ead 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>
Upstream-commit: af439c7a8da878450d0e5583935a1c4208fa92ad
Component: engine
2016-06-09 09:47:13 -04:00
6075499108 Merge pull request #23063 from yongtang/22961-aws-sdk-go
Update aws-sdk-go to v1.1.30
Upstream-commit: 3f970819bb4231375f7821aa54670fd59e384f4d
Component: engine
2016-06-05 16:01:52 -04: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
5578aba972 Merge pull request #23193 from allencloud/fix-typos
use grep to find all a/an typos
Upstream-commit: 98c245c9e63793cf8ca03c5500e0820447c1861c
Component: engine
2016-06-02 18:45:08 -07:00
04d8138246 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)
Upstream-commit: 0da0a8f9dae35e6a9cb63b9e4a3285e24c001af3
Component: engine
2016-06-02 10:17:07 -04:00
35c5774373 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: c1be45fa38e82054dcad606d71446a662524f2d5
Component: engine
2016-06-02 17:17:22 +08:00
0593e6d766 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>
Upstream-commit: 518709a87e04f55babc5162861aa4ba9a423f0c8
Component: engine
2016-06-02 13:10:51 +09:00