Repository navigation
Implement journald logging driver - #1062
Conversation
9edae9d to
dfb7419
Compare
| found := 0 | ||
| check := func(log poll.LogT) poll.Result { | ||
| c, err := jr.Read(b) | ||
| assert.NilError(t, err) |
There was a problem hiding this comment.
Can we verify the content? How is it formatted?
There was a problem hiding this comment.
fixed, our scope is to check that the tag is well formated and this is guaranteed with SYSLOG IDENTIFIER. Other log part are handled in the journald scope
af23936 to
0372a81
Compare
1bb2a52 to
94c079b
Compare
9f3bf9b to
640e0de
Compare
| inspectedContainer := base.InspectContainer(containerName) | ||
| found := 0 | ||
| check := func(log poll.LogT) poll.Result { | ||
| res := icmd.RunCmd(icmd.Command("journalctl", "--no-pager", fmt.Sprintf("SYSLOG_IDENTIFIER=%s", inspectedContainer.ID[:12]))) |
There was a problem hiding this comment.
needs something like --since <timestamp>, otherwise journalctl produces a huge hog
|
Can we implement |
3ddd2ec to
759713d
Compare
5a78ae8 to
1b36608
Compare
| Flags: | ||
| - :whale: `--f, --follow`: Follow log output | ||
| - :whale: `--since`: Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) | ||
| - for journald log driver logs since relative should be in this format `42 minutes ago` |
There was a problem hiding this comment.
Can we just use the same format?
If difficult this flag can be implemented in a separate PR.
| return jsonfile.Decode(os.Stdout, os.Stderr, reader, timestamps, since, until, logsEOFChan) | ||
| case "journald": | ||
| var journalctlArgs []string | ||
| journalctlArgs = append(journalctlArgs, fmt.Sprintf("SYSLOG_IDENTIFIER=%s", found.Container.ID()[:12])) |
There was a problem hiding this comment.
Please use a const or at least add a comment line for 12
| journalctlArgs = append(journalctlArgs, "-f") | ||
| } | ||
| if since != "" { | ||
| journalctlArgs = append(journalctlArgs, "--since", since) |
There was a problem hiding this comment.
| journalctlArgs = append(journalctlArgs, "--since", since) | |
| journalctlArgs = append(journalctlArgs, "--since", since + " ago") |
| } | ||
| return jsonfile.Decode(os.Stdout, os.Stderr, reader, timestamps, since, until, logsEOFChan) | ||
| case "journald": | ||
| var journalctlArgs []string |
There was a problem hiding this comment.
Please add --output=cat to eliminate extra header
|
|
||
| var syslogIdentifier string | ||
| if _, ok := journaldLogger.Opts[Tag]; !ok { | ||
| syslogIdentifier = config.ID[:12] |
There was a problem hiding this comment.
Please add a const or at least add a comment line for this magic number
81be1dd to
16f8c5c
Compare
Signed-off-by: Fahed DORGAA <[email protected]>
16f8c5c to
dd8a0ff
Compare
enhance #1039 with
journaldlog driver