Commit Graph

79 Commits

Author SHA1 Message Date
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
be7836d63c Fix race condition in JSONFileLogger.Log
Signed-off-by: Ingo Gottwald <in.gottwald@gmail.com>
Upstream-commit: f8c54200805a9b9088c90f0b46bfa848d7bae67c
Component: engine
2016-01-03 22:45:56 +01:00
c737574605 Merge pull request #18759 from mikedanese/doc-fix
daemon/logger: fix typo in godoc
Upstream-commit: 6bf8844f1179108b9fabd271a655bf9eaaf1ee8c
Component: engine
2015-12-17 19:26:41 -05:00
f814dbe783 daemon/logger: fix typo in godoc
Signed-off-by: Mike Danese <mikedanese@google.com>
Upstream-commit: 881a30c707141b06af0cc7a076b62ff338615f2b
Component: engine
2015-12-17 15:52:33 -08:00
3d517a11e5 Replace pkg/units with docker/go-units.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 4fef42ba206ac90346e6e0fe25bead3f77dc4b0f
Component: engine
2015-12-16 12:26:49 -05:00
7f43cd332d Move timeutils functions to the only places where they are used.
- Move time json marshaling to the jsonlog package: this is a docker
  internal hack that we should not promote as a library.
- Move Timestamp encoding/decoding functions to the API types: This is
  only used there. It could be a standalone library but I don't this
it's worth having a separated repo for this. It could introduce more
complexity than it solves.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 27220ecc6b1eedf650ca9cf94965cb0dc2054efd
Component: engine
2015-12-15 14:56:14 -05:00
3c4fcf6b7a Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
Upstream-commit: 927b334ebfc786276a039e45ec097e71bf9a104c
Component: engine
2015-12-13 18:04:12 +02:00
46aa4e0b30 dont trim gelf log message
Signed-off-by: Marius Sturm <marius@graylog.com>
Upstream-commit: a31435c8a2c4560b6e1a0e84450c45490fa587be
Component: engine
2015-12-11 10:28:24 +01:00
fb726f0d76 Revert "prevent journald from being built on ARM"
This reverts commit 6f6f10a75f8b447637e8a89d685452871899e9c0, so that we
can apply a different workaround.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
Upstream-commit: 0ca6d77e6e17ea378ff04b59f971dc1338e0ddc2
Component: engine
2015-12-02 10:30:13 -05:00
8f5a861b89 prevent journald from being built on ARM
Signed-off-by: Govinda Fichtner <govinda.fichtner@googlemail.com>
Upstream-commit: 6f6f10a75f8b447637e8a89d685452871899e9c0
Component: engine
2015-11-21 15:17:31 +01:00
804455e1fb Merge pull request #17593 from daehyeok/refactoring_json_log
Refactoring json log driver
Upstream-commit: adce1981f4c7fe653ae76cdd1f84d75f88b273cd
Component: engine
2015-11-17 15:38:52 -08:00
cbf9321ca8 Merge pull request #17891 from splunk/splunk-logger-support-for-tag-env-labels
Allow configurable metadata for Splunk log driver
Upstream-commit: a3065fa48f889ef438a7d7339ebc8fe01aca10dd
Component: engine
2015-11-16 10:11:27 -08:00
c0f1567bbc Extract rotate file writer from json log driver
Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
Upstream-commit: 086c0b4a6616e8db8009a5d72411bcc6774adaf1
Component: engine
2015-11-14 16:15:44 -07:00
1a8e0677b9 Merge pull request #17417 from cpuguy83/15815_add_log_file_poller
Fallback to file polling for jsonlog reader on err
Upstream-commit: 42fa8e31284c76f485bed81ed2e1327d60e5cb13
Component: engine
2015-11-13 11:49:54 -08:00
bba768bb09 Allow configurable metadata for Splunk log driver
Add support of `tag`, `env` and `labels` for Splunk logging driver.
Removed from message `containerId` as it is the same as `tag`.

Signed-off-by: Denis Gladkikh <denis@gladkikh.email>
Upstream-commit: 26855c780184c528446957bd77821c6f4c74b343
Component: engine
2015-11-12 06:36:51 -08:00
48001c30bb dockerversion placeholder for library import
- Add a *version* file placeholder.
- Update autogen and builds to use it and an autogen build flag

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 8054a303870b81eebe05e38261c1b68197b68558
Component: engine
2015-11-09 19:32:46 +01:00
66c6bac35d Fallback to file polling for jsonlog reader on err
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c136a33c5bf233f4ce108a8a8481d78aeaec93cc
Component: engine
2015-11-05 10:05:05 -05:00
74b08273a6 increase the maxJSONDecodeRetry in json log reader
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: a82f9ac81956c6b63772c9c720878d377dd9ee02
Component: engine
2015-11-02 17:51:22 +08:00
08bc723a70 Merge pull request #17568 from Microsoft/10662-journald
Windows: Fix journald compile error
Upstream-commit: 8d584da96e71691d2d70c493818c2b056f7553c5
Component: engine
2015-10-31 09:35:39 -07:00
bb88c5713c Windows: Fix journald compile error
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 5452954d89160985d4d896f4241f1838b4114413
Component: engine
2015-10-31 08:31:25 -07:00
7f7650a345 Merge pull request #17537 from mountkin/fix-logger-race
fix a race in json logger reader
Upstream-commit: ed6e3cf7043e7454e10e390bc1a33343e3615c5d
Component: engine
2015-10-30 23:00:17 -07:00
3e20fd363b fix a race in json logger reader
The json decoder starts to decode immediately an inotify event is
received.
But at the time the inotify event is trigged, the json log
entry might haven't been fully written to the disk.
In this case the decoder will return an "io.UnexpectedEOF" error, but
there is still data remaining in the decoder's buffer. And the data
should be passed to the decoder when the next inotify event is
triggered.

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: e41eae8b42052d07432405cca113ffcf8cf49c06
Component: engine
2015-10-31 02:28:23 +08:00
2e804d8f73 Windows build broken on master (awslogs)
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 2716e3964d7e30e924e7f5da3d7923c9f286cff2
Component: engine
2015-10-30 10:02:32 -07:00
069f98c935 [awslogs] Auto-detect region on EC2 instances
Signed-off-by: Samuel Karp <skarp@amazon.com>
Upstream-commit: 8a6dfb26f30331231839c420f8cf8889c9ef35a8
Component: engine
2015-10-27 23:47:28 +00:00
32f8320544 [awslogs] Set User-Agent for Amazon CloudWatch Logs
Signed-off-by: Samuel Karp <skarp@amazon.com>
Upstream-commit: 480c9c01784d65a46f6ba62e8176e9b2a6a3feab
Component: engine
2015-10-27 23:47:19 +00:00
2e7de41d92 Update vendored aws-sdk-go
Signed-off-by: Samuel Karp <skarp@amazon.com>
Upstream-commit: 70083e6fc3a7f64755fcf4752e6d24758bdd0543
Component: engine
2015-10-27 23:43:51 +00:00
7a1aba432f Add Splunk logging driver #16207
Allow to send Splunk logs using Http Event Collector

Signed-off-by: Denis Gladkikh <denis@gladkikh.email>
Upstream-commit: 1f1dbf312ddc299bdad408ce3d6b71f4f5993652
Component: engine
2015-10-23 13:37:53 -07:00
1ba0019242 add labels/env log option for jsonfile
this allows jsonfile logger to collect extra metadata from containers with
`--log-opt labels=label1,label2 --log-opt env=env1,env2`.

Extra attributes are saved into `attrs` attributes for each log data.

Signed-off-by: Daniel Dao <dqminh@cloudflare.com>
Upstream-commit: 0083f6e984894b4d3697c1ae63547c07eea697af
Component: engine
2015-10-12 21:12:46 +02:00
21e1fc0995 add labels/env log option for journald
this allows journald logger to collect extra metadata from containers with
`--log-opt labels=label1,label2 --log-opt env=env1,env2`

Signed-off-by: Daniel Dao <dqminh@cloudflare.com>
Upstream-commit: 11a24f19c2da88b6c3b50114863f24c06c5ce2fd
Component: engine
2015-10-12 21:12:46 +02:00
8aebdf0c20 add labels/env log option for fluentd
this allows fluentd logger to collect extra metadata from containers with
`--log-opt labels=label1,label2 --log-opt env=env1,env2`

Signed-off-by: Daniel Dao <dqminh@cloudflare.com>
Upstream-commit: 4cc8490283fdc8315f595be3e32951929e65bb40
Component: engine
2015-10-12 21:12:46 +02:00
d5bd4c9ab4 add labels/env log option for gelf
this allows gelf logger to collect extra metadata from containers with
`--log-opt labels=label1,label2 --log-opt env=env1,env2`

Additional log field will be prefixed with `_` as per gelf protocol
https://www.graylog.org/resources/gelf/

Signed-off-by: Daniel Dao <dqminh@cloudflare.com>
Upstream-commit: 5794a0190d7505e998116f1321ae39b001d0e710
Component: engine
2015-10-12 21:12:46 +02:00
bc80b0014f add env and labels to log context
Signed-off-by: Daniel Dao <dqminh@cloudflare.com>
Upstream-commit: 656cdbb0e96a1f8531b118caedd8e9b3d281c201
Component: engine
2015-10-12 21:12:46 +02:00
72ffa04366 daemon: logger: error out on daemon start if invalid logger address
If an invalid logger address is provided on daemon start it will
silently fail. As syslog driver is doing, this check should be done on
daemon start and prevent it from starting even in other drivers.
This patch also adds integration tests for this behavior.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Upstream-commit: e3c472426ff1dccf083e41dbbfdf5935921bf330
Component: engine
2015-09-20 16:20:25 +02: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
7d3bcc0ea2 Remove unnecessary check for nil CString
@noxiouz points out that we don't need to check for a nil result from
C.CString(), since an out-of-memory condition causes a runtime panic
instead.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
Upstream-commit: 11fda783f85e1f6027c997c6b044c65288c89099
Component: engine
2015-09-14 14:16:48 -04:00
862065b3b2 Add log reading to the journald log driver
If a logdriver doesn't register a callback function to validate log
options, it won't be usable.  Fix the journald driver by adding a dummy
validator.

Teach the client and the daemon's "logs" logic that the server can also
supply "logs" data via the "journald" driver.  Update documentation and
tests that depend on error messages.

Add support for reading log data from the systemd journal to the
journald log driver.  The internal logic uses a goroutine to scan the
journal for matching entries after any specified cutoff time, formats
the messages from those entries as JSONLog messages, and stuffs the
results down a pipe whose reading end we hand back to the caller.

If we are missing any of the 'linux', 'cgo', or 'journald' build tags,
however, we don't implement a reader, so the 'logs' endpoint will still
return an error.

Make the necessary changes to the build setup to ensure that support for
reading container logs from the systemd journal is built.

Rename the Jmap member of the journald logdriver's struct to "vars" to
make it non-public, and to make it easier to tell that it's just there
to hold additional variable values that we want journald to record along
with log data that we're sending to it.

In the client, don't assume that we know which logdrivers the server
implements, and remove the check that looks at the server.  It's
redundant because the server already knows, and the check also makes
using older clients with newer servers (which may have new logdrivers in
them) unnecessarily hard.

When we try to "logs" and have to report that the container's logdriver
doesn't support reading, send the error message through the
might-be-a-multiplexer so that clients which are expecting multiplexed
data will be able to properly display the error, instead of tripping
over the data and printing a less helpful "Unrecognized input header"
error.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)
Upstream-commit: e611a189cb3147cd79ccabfe8ba61ae3e3e28459
Component: engine
2015-09-11 16:50:03 -04:00
726b8dc951 awslogs: fix logrus import
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 32964def832f76f29991100c76af09513de19693
Component: engine
2015-09-11 11:05:06 -07:00
56082f8faa Add awslogs driver for Amazon CloudWatch Logs
Signed-off-by: Samuel Karp <skarp@amazon.com>
Upstream-commit: 3effe484e6f572298d0c3490517f57391617aa51
Component: engine
2015-09-09 13:52:40 -07:00
57a4ccd575 Merge pull request #15649 from LK4D4/syslog_validation
Syslog validation
Upstream-commit: 8aa520b8c020dd78055fbf4423ca0c086f3e4bf4
Component: engine
2015-08-18 11:14:31 -07:00
3107abf81b Fix error message in max-file validation
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: cde607108badc84ddb6a7e2d2f75ce31be9967a5
Component: engine
2015-08-17 15:34:39 -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
8adfc237c0 Remove doc that doesn't apply to Journald.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: f1412f29423def166b0d77e162eec867afc56a8c
Component: engine
2015-08-09 22:12:42 -05:00
305eb65786 Enable golint in pkg/jsonlog and pkg/jsonmessage.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 5220f3b535ce38edbff616bc78f1eb92148d310e
Component: engine
2015-08-08 11:28:22 +08:00
ed793e492c Remove unused variable
Introduced by #15209 unintentionally.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: f5557f4f43ba89a448131fbca8094f9cf8ddb097
Component: engine
2015-08-03 09:14:52 +08:00
23023fa5ed Ensure reader position is at the end after tailing
After tailing a file, if the number of lines requested is > the number
of lines in the file, this would cause a json unmarshalling error to
occur when we later try to go follow the file.
So brute force set it to the end if any tailing occurred.

There is potential that there could be some missing log messages if logs
are being written very quickly, however I was not able to make this
happen even with `while true; do echo hello; done`, so this is probably
acceptable.

While testing this I also found a panic in LogWatcher.Close can be
called twice due to a race. Fix channel close to only close when there
has been no signal to the channel.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c57faa91e2dab72a0a0905dc10e5cbdf55b545f5
Component: engine
2015-08-01 08:00:28 -04: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
9da89dbbd1 Doc fixes in logger, update NewCopier method
Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
Upstream-commit: 41d85c014defd96cda06abac73554d9f9d1de0d8
Component: engine
2015-07-29 10:05:46 -07:00
905c09e034 Use math.MaxInt32 instead of math.MaxUint32
I think it was original intention, because even half of a comment was about
MaxInt32.

Fix #15038

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: eb45602d2fa0fac8a694d2afb1c59ef60b0e1f77
Component: engine
2015-07-27 13:11:16 -07:00
ffc7323b60 Fix option validation for log-drivers without it
There is no option validation for "journald" log-driver, so it makes no
sense to fail in that case.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: d68c55bc72625bce226971ef6e760530e9a15ce3
Component: engine
2015-07-24 09:00:53 -07:00