Commit Graph

23 Commits

Author SHA1 Message Date
697f71e4f2 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>
Upstream-commit: bd9d14a07b9f1c82625dc8483245caf3fa7fe9e6
Component: engine
2016-05-06 20:42:20 -04:00
ae0977f1d1 fix variables that werent being called
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 0e025b4bb16c0d4cc6b3f0c040713d061b9b051a
Component: engine
2016-03-17 13:19:55 -07: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
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
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
6e5f69c519 remove dead code after decoupling from jsonlog
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: d3b3ebc3a4e185da08ec049bbeba46e942f30c80
Component: engine
2015-07-21 20:47:35 -04:00
9e13a75360 Add test coverage to pkg/jsonlog
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: e7a9a0bed84dc04db8d68dfc48fe095c5ce3edcb
Component: engine
2015-06-27 10:13:47 +02:00
792a1ace8a Make sure log pipes are closed
Pipes are still not closed (and goroutines leaked) if neither pipe is
used.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: e3ba3dd5b828307c3970d0036b019eca405e4a2c
Component: engine
2015-05-12 13:50:51 -04:00
365c18080f Add --since argument to docker logs cmd
Added --since argument to `docker logs` command. Accept unix
timestamps and shows logs only created after the specified date.

Default value is 0 and passing default value or not specifying
the value in the request causes parameter to be ignored (behavior
prior to this change).

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: cb9a6b9aed1577bb5590300125d05d9b1c201c16
Component: engine
2015-05-10 20:42:14 +00:00
954f940156 Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 844538142d95c1b7dda1bb2903179510105fe9b5
Component: engine
2015-04-27 21:50:33 +02:00
a17bdc8390 pkg/jsonlog: add JSONLogBytes for low allocations
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: b535ed3595036931e8e6f4e9da7cd2beb67cb19e
Component: engine
2015-04-01 01:02:18 +03:00
e5b36a723c Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 6f4d847046cb4e072de61d042c0266190d73a8c9
Component: engine
2015-03-26 23:22:04 +01:00
ac657c8159 Rename BINDDIR to BIND_DIR
It turns out the back-to-back `D`s here were tripping people up because visually, it looks like a typo.  This renames the variable to `BIND_DIR`, but allows `BINDDIR` to continue working for backwards-compatibility.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
Upstream-commit: 987050a52b0ce6d5ae77554a03af5923304bd3e5
Component: engine
2015-02-13 15:50:42 -07:00
b0b84165b4 Fix logs, so now, old and followed logs has same format without []
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: e16bcc3928d0ae07cb9c02840fbb92f1ed2a7a3f
Component: engine
2015-01-28 17:57:10 -08:00
1429a5fb4a update sysinfo to logrus
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 0a37f836adef969e9e5aa9ce7b2c465f9441c1a5
Component: engine
2014-10-27 18:59:02 +00:00
a6c06e4ad8 Test for jsonlog.WriteLog
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 2add198a7abc084dd394f61ed26057ec5d639a4c
Component: engine
2014-09-23 19:19:25 +04:00
8dd6b83d46 Benchmark for jsonlog.WriteLog
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 81c9927f8f3c190ed9dd15b62716a240ce20fc51
Component: engine
2014-09-23 18:24:18 +04:00
98789bf31d pkg/jsonlog: avoid JSONLog allocation in loop
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 473bb5274ce7a520bc73ccb3529f99729a799062
Component: engine
2014-09-22 18:57:28 +03:00
f5deb7d0f9 Close logs pipes and catch write errors
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: a7ee201ee85c95afb8556323d79e32cf9e2d8737
Component: engine
2014-09-22 10:55:46 +04:00
750e7b6a57 Change unused WriteCloser to Writer
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: fd3f2e175fa6ddb606d2c681ff86a97faccfebbd
Component: engine
2014-09-22 10:54:58 +04:00
a9aedbcc8a use custom marshalling for JSONLog
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 9851e8c4c18a89327ec2c1f04e36c9932c4231c1
Component: engine
2014-09-17 17:03:54 +03:00
325695b856 utils.Debugf -> log.Printf, move jsonlog to own package.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 5cdb9c8acab75df74d20cd937e4091dacb355160
Component: engine
2014-08-06 16:39:01 -07:00