Commit graph

23 commits

Author SHA1 Message Date
Brian Goff
d0200e7fea 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>
2016-05-06 20:42:20 -04:00
Jessica Frazelle
b9fcb41e6d fix variables that werent being called
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-03-17 13:19:55 -07:00
David Calavera
0585b88aee 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>
2015-12-15 14:56:14 -05:00
Justas Brazauskas
244162287a Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
2015-12-13 18:04:12 +02:00
Daniel Dao
154434f5a2 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>
2015-10-12 21:12:46 +02:00
Lei Jitang
520fe05c54 Enable golint in pkg/jsonlog and pkg/jsonmessage.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-08-08 11:28:22 +08:00
Brian Goff
b16ccd9856 remove dead code after decoupling from jsonlog
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-07-21 20:47:35 -04:00
Vincent Demeester
3b6898cf72 Add test coverage to pkg/jsonlog
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-06-27 10:13:47 +02:00
Brian Goff
9b30befa9d 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>
2015-05-12 13:50:51 -04:00
Ahmet Alp Balkan
9892ab0af7 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>
2015-05-10 20:42:14 +00:00
Antonio Murdaca
2026dbd41d Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-27 21:50:33 +02:00
unclejack
90c3318cb6 pkg/jsonlog: add JSONLogBytes for low allocations
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-04-01 01:02:18 +03:00
Antonio Murdaca
18180bfabf Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-26 23:22:04 +01:00
Tianon Gravi
ed92fa5a28 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>
2015-02-13 15:50:42 -07:00
Alexander Morozov
905242e00a Fix logs, so now, old and followed logs has same format without []
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-01-28 17:57:10 -08:00
Victor Vieux
61b6781d59 update sysinfo to logrus
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-10-27 18:59:02 +00:00
Alexandr Morozov
56483ba9b4 Test for jsonlog.WriteLog
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-09-23 19:19:25 +04:00
Alexandr Morozov
4b052e7192 Benchmark for jsonlog.WriteLog
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-09-23 18:24:18 +04:00
unclejack
deaded4ca8 pkg/jsonlog: avoid JSONLog allocation in loop
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-09-22 18:57:28 +03:00
Alexandr Morozov
be805c6709 Close logs pipes and catch write errors
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-09-22 10:55:46 +04:00
Alexandr Morozov
f87a053913 Change unused WriteCloser to Writer
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-09-22 10:54:58 +04:00
unclejack
df3e370955 use custom marshalling for JSONLog
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-09-17 17:03:54 +03:00
Erik Hollensbe
cc2edda3b8 utils.Debugf -> log.Printf, move jsonlog to own package.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-08-06 16:39:01 -07:00