Commit Graph

47 Commits

Author SHA1 Message Date
2e315f18e1 Pass endpoint to the CloudWatch Logs logging driver
Signed-off-by: haikuoliu <haikuo@amazon.com>
Upstream-commit: 998478d369ad3784c3cd28038d836c3c94b16936
Component: engine
2018-06-29 11:27:37 -07:00
4cadaa03f8 Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 38457285242e57306c5b7ee652c7ccbb9fbd6713
Component: engine
2018-06-13 09:04:30 +02:00
0f96e98e12 Various code-cleanup
remove unnescessary import aliases, brackets, and so on.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f23c00d8701e4bd0f2372a586dacbf66a26f9a51
Component: engine
2018-05-23 17:50:54 +02:00
0074e6a87b Merge pull request #36522 from IRCody/awslogs-non-blocking
Allow awslogs to use non-blocking mode
Upstream-commit: fe2d3a1551f666465e65ec4337e92b774a5e81f1
Component: engine
2018-05-01 16:30:52 -04:00
257c410f05 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>
Upstream-commit: c7e379988c9cd6ec0af528e6f59eea3c51b36738
Component: engine
2018-04-27 17:59:03 +00:00
60daf5fa97 Automated migration using
gty-migrate-from-testify --ignore-build-tags

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6be0f709830113966f295401327b027ec2f0bbca
Component: engine
2018-03-16 11:03:43 -04:00
1c9c9f9e72 Cleanup some assertions
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: ef01dea8935932486f03a37069720987e805dce6
Component: engine
2018-03-16 10:54:54 -04:00
be83c11fb0 Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4f0d95fa6ee7f865597c03b9e63702cdcb0f7067
Component: engine
2018-02-05 16:51:57 -05:00
362cc9aedc Don't append new line for maximum sized events
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: d3e2d55a3d84d41c331151c9633211f0fb6a3096
Component: engine
2018-01-21 14:29:55 +13:00
63a4263b5f 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>
Upstream-commit: ad14dbf1346742f0607d7c28a8ef3d4064f5f9fd
Component: engine
2017-12-13 15:27:16 -08:00
89f40238db Merge pull request #34888 from jahkeup/sized-logger
logger: copy to log driver's bufsize, fixes #34887
Upstream-commit: dfc2d62632d32f9d38166ea477f0ca033a5c91c2
Component: engine
2017-10-30 12:37:41 -07:00
bd61323342 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>
Upstream-commit: e1ada0b885b31de0bb0e79b4d99ae4d48b65f721
Component: engine
2017-10-30 16:25:09 +00:00
7a1f68fd02 Add credentials endpoint option for awslogs driver
Signed-off-by: Adnan Khan <adnkha@amazon.com>
Upstream-commit: c7cc9d67590dd11343336c121e3629924a9894e9
Component: engine
2017-10-02 00:25:49 -07:00
de626e10fb Fix golint errors.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9b47b7b1519c5f2138e2933fb1fc459eb00895c0
Component: engine
2017-08-18 14:23:44 -04:00
6ed8995fb3 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>
Upstream-commit: 9ef3b535974612b137abae062b7a8a0f7e969871
Component: engine
2017-08-08 18:16:41 +02:00
d659edcaf5 Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: 1009e6a40b295187e038b67e184e9c0384d95538
Component: engine
2017-07-31 13:16:46 -07:00
cf98674bff Fix awslogs driver repeating last event - #34292
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: 0fd5a0bab79f20f910cb7551ec34158a32e05f5a
Component: engine
2017-07-28 20:33:14 +12:00
643654c2f0 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>
Upstream-commit: 39bcaee47b8a284a46b761afe218ba7deda0d482
Component: engine
2017-07-03 13:13:09 -07:00
17712f857a Improved poor memory efficiency of awslogs
Signed-off-by: YAMASAKI Masahide <masahide.y@gmail.com>
Upstream-commit: 524f30634018ce619da61aa0a13dad245e098226
Component: engine
2017-05-18 23:30:00 +09:00
2d5cb49e4e Update comments describing new behaviour
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: dc87490b632949394307e25dce17c8db6cf664c6
Component: engine
2017-05-15 11:08:16 +12:00
2373c13c5a Code review changes
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: 3a4cf2b076a8f04f54b6edff4f661f5c3b2c8157
Component: engine
2017-05-15 10:28:18 +12:00
6083b78b58 Add missing month in datetime map
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: bf1c377f6012f3db714e0f848d70e776ef1226a6
Component: engine
2017-05-13 22:10:51 +12:00
3ac82c3d80 Append new line to multiline events
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: 4374f16667708118c126cd71f733493b0070e807
Component: engine
2017-05-13 17:54:04 +12:00
7dd003d1da Code review changes
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: 8ef9c19ecdd16881289a63e5e89de3f5c83def66
Component: engine
2017-05-13 17:54:04 +12:00
38049ee803 awslogs: use github.com/pkg/errors to wrap an error
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: f775005a17c7ae0d3851cc86f46b7c46aafa27d8
Component: engine
2017-05-13 17:54:04 +12:00
17b96f5ff1 Formatting
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: 6f073e352247217a4cc5ee825676a9a496655455
Component: engine
2017-05-13 17:54:04 +12:00
4221bdc95f Add awslogs benchmarks
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: 84b03660dab03ac366d99ba817a5ec8523808386
Component: engine
2017-05-13 17:54:04 +12:00
db722ea7f6 Add awslogs multiline support
Signed-off-by: Justin Menga <justin.menga@gmail.com>
Upstream-commit: ab74038df93156ef27c03d6e4490bca5c3359423
Component: engine
2017-05-13 17:54:04 +12:00
c238856aa4 Use sync.Pool for logger Messages
This reduces allocs and bytes used per log entry significantly as well
as some improvement to time per log operation.

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

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 3f4fccb65f0ef286c9c4e0f01c4ae7bb09a6ad89
Component: engine
2017-02-01 13:52:37 -05:00
11a6f80b8b 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>
Upstream-commit: 054abff3b67bb5d66323e5418a43c845a3eac8a1
Component: engine
2017-02-01 13:52:37 -05:00
733876ff1e 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>
Upstream-commit: 864b0c2e47e66e1037115b5d7267e641ba776d49
Component: engine
2017-01-27 11:15:17 -08:00
cabd6a6108 Rename 'context' to 'loginfo' in the logger module
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

gofmt

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

update

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

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

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

change 'LogInfo' to 'Info'

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

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Upstream-commit: 17ec911da7d4b77b069d9f6c8c010865e19acc6c
Component: engine
2016-12-29 19:13:44 +08:00
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
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
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
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
b039e514c3 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>
Upstream-commit: 46ea8ff75d03999e08f77f526e93d8489eb0fabd
Component: engine
2016-05-28 18:49:17 -07:00
8c21a32e0f awslogs: Fix a race in mockcwlogsclient
Signed-off-by: Samuel Karp <skarp@amazon.com>
Upstream-commit: c1ad02ccc8791b3c517aa37223d27792863cbf17
Component: engine
2016-05-25 11:50:22 -07:00
b5af51fa11 daemon: remove some unused code
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: b9966f3a81e89640d0de8fa5ae8d38213df0b8fe
Component: engine
2016-03-31 11:24:12 -07: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
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
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