Commit Graph

63 Commits

Author SHA1 Message Date
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
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
5104b34c44 Split reader interface from logger interface
Implement new reader interface on jsonfile.
Moves jsonlog decoding from daemon to jsonfile logger.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c0391bf5545afef5e675138556c39e4c0e9bf91b
Component: engine
2015-07-21 20:47:31 -04:00
fb988a52e9 add support for maximum log size, and max number of log files
Signed-off-by: wlan0 <sidharthamn@gmail.com>
Upstream-commit: 9b782d3af322bd8d9cf857d63eb7f2e0fe484c90
Component: engine
2015-07-02 06:26:06 -07:00
22652d4dad Add new logging driver: fluentd
Signed-off-by: TAGOMORI Satoshi <tagomoris@gmail.com>
Upstream-commit: 361a582ba0bccea04a8ea1799e68779fa66abb9f
Component: engine
2015-06-26 11:03:11 +09:00
f157b240b8 Add --log-opt to specify facility for syslog driver
Signed-off-by: Dennis Docter <dennis@d23.nl>
Upstream-commit: 609e7b0a55d4082fce40eabae3a06ca57c188ba5
Component: engine
2015-06-23 14:04:25 +02:00
0c0594818f add UDP GELF logging-driver
allows to send container logs to Graylog or Logstash.

Signed-off-by: Marius Sturm <marius@graylog.com>
Upstream-commit: 96d06e106fb9e35e5a526054d3aa0152152a9cc4
Component: engine
2015-06-10 20:21:50 +02:00
f8248bbabf Add syslog-tag option for syslog log-driver
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a81af2e26a19cca0ffb8cbfa619169d55d604789
Component: engine
2015-06-02 12:43:00 -07:00
24139366a7 Merge pull request #13564 from burke/fix-memory-leak
Use bufio.Reader instead of bufio.Scanner for logger.Copier
Upstream-commit: c42810fe9981c07e7de55aa65af44d618dd4e6ce
Component: engine
2015-05-29 13:37:15 -07:00
c9400d42cc Use bufio.Reader instead of bufio.Scanner for logger.Copier
When using a scanner, log lines over 64K will crash the Copier with
bufio.ErrTooLong. Subsequently, the ioutils.bufReader will grow without
bound as the logs are no longer being flushed to disk.

Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
Upstream-commit: f779cfc5d8b8f0686c3849a3bd4ab0480675180d
Component: engine
2015-05-29 12:29:42 -04:00
8d306cf8a5 Add syslog-address log-opt
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: e8c88d253337776a6075c9db69140ce2c5014622
Component: engine
2015-05-29 00:42:11 +02:00
bcf5956dfc Pass -log-opts map to logdrivers
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: 8b11592d699df669b529e34658ef2d870c8a75f8
Component: engine
2015-05-18 16:50:14 +00:00
38fd09288b Windows: Factor out syslog and journald
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 655a58e27bfcfd2494bb5d46f95cb49d655ad17a
Component: engine
2015-05-14 10:34:09 -07:00
b1b57c9cd4 daemon: Logging drivers refactoring
- noplog driver pkg for '--log-driver=none' (null object pattern)
- centralized factory for log drivers (instead of case/switch)
- logging drivers registers themselves to factory upon import
  (easy plug/unplug of drivers in daemon/logdrivers.go)
- daemon now doesn't start with an invalid log driver
- Name() method of loggers is actually now their cli names (made it useful)
- generalized Read() logic, made it unsupported except json-file (preserves
  existing behavior)

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

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: 3a8728b431df07249ad913ea9a12e27dc39b8956
Component: engine
2015-05-12 19:11:52 +00:00
72fc3b7751 journald log driver: use CONTAINER_ID field for container id
This patch modifies the journald log driver to store the container ID in
a field named CONTAINER_ID, rather than (ab)using the MESSAGE_ID field.
Additionally, this adds the CONTAINER_ID_FULL field containing the
complete container ID and CONTAINER_NAME, containing the container name.

When using the journald log driver, this permits you to see log messages
from a particular container like this:

    # journalctl CONTAINER_ID=a9238443e193

Example output from "journalctl -o verbose" includes the following:

    CONTAINER_ID=27aae7361e67
    CONTAINER_ID_FULL=27aae7361e67e2b4d3864280acd2b80e78daf8ec73786d8b68f3afeeaabbd4c4
    CONTAINER_NAME=web

Closes: #12864
Signed-off-by: Lars Kellogg-Stedman <lars@redhat.com>
Upstream-commit: 869ecba652294e069874c83591d6f1b469d7cc32
Component: engine
2015-04-30 10:42:27 -04:00
b04ccc089c Add journald as a supported logger for containers
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Upstream-commit: 364287b74118de4f04d049426ef37fa9936d2065
Component: engine
2015-04-21 12:57:54 -04:00
78dcc43512 Change syslog format and facility
This patch changes two things

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

Signed-off-by: Darren Shepherd <darren@rancher.com>
Upstream-commit: 05641ccffc5088a382fa3bfb21f1276ccb6c1fc0
Component: engine
2015-04-15 12:46:43 -07:00
73f3660a47 move syslog-tag to syslog.New function
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 4f91a333d5c9d66ce109c36e7261dbfd3382ebbf
Component: engine
2015-04-13 11:24:18 -07:00