Commit Graph

14 Commits

Author SHA1 Message Date
Daniel Smith
cda7577e3c
ensured dumpFollow of logread includes 'follow' behaviour
Signed-off-by: Daniel Smith <daniel@razorsecure.com>
2024-07-03 13:55:46 +01:00
Christoph Ostarek
cc374a5ea8 logread: do not close socket too early
only close socket once reading is finished

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
2023-12-18 14:12:40 +01:00
Avi Deitcher
997c074db6 expose logread function
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2023-06-30 06:02:16 +03:00
Avi Deitcher
b7002c0eb2 logread should not panic on an EOF, instead exiting gracefully
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2023-06-19 17:50:35 +03:00
David Gageot
39807bb0bd Remove dead or redundant code
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 15:33:42 +02:00
David Gageot
acbef4424a
Make the linter happy
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-07-22 15:02:19 +02:00
David Gageot
0b136bf80d
Write log entries as json
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-07-22 14:41:23 +02:00
Emmanuel Briney
e254145257 Use RFC3339Nano for timestamps
Signed-off-by: Emmanuel Briney <emmanuel.briney@docker.com>
2021-11-26 16:41:51 +01:00
David Scott
ddee5f27f3 memlogd/logwrite: use the same naming convention as init
In e8786d73bb the logwrite package will
automatically append .log to every log.

In 5201049f2c the init package will send
stderr of a service `s` to a log named `s` and the stdout to `s.out`.
Therefore the files we create on disk are `s.log` and `s.out.log`.

This patch modifies the memlogd `logwrite` command-line wrapper to use
the same convention.

Note there is a confusing name clash between `pkg/logwrite` and `cmd/logwrite`
in `memlogd` modified here.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-20 15:31:29 +01:00
David Scott
a07ecf60d5 memlogd: use kmsg format for reading the logs
Switch to a more formally-specified `kmsg`-style format for reading
the logs.

- update the spec in docs/logging.md
- check for bad names in pkg/memlogd with unit test

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:49:26 +01:00
David Scott
fe64f33430 memlogd: add test cases
- check writing to the log does not block
- check the log doesn't expand -- it should be finite
- check that client connections don't buffer arbitrary amounts of
  data if the client is slow

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:49:26 +01:00
David Scott
6aca715ad8 memlogd: replace an unbounded buffer with bounded channel
Previously we had a per-connection

  bytes.Buffer // to be written to the connection
  sync.Cond    // to allow us to Wait for more data

This had the major disadvantage that the buffer was unbounded and so
a slow client could cause memory exhaustion in the server. This patch
replaces these with a single

  chan *logEntry

which is naturally bounded and supports blocking read. We make write
non-blocking using select i.e. we drop messages rather than allocate
more space.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:49:26 +01:00
David Scott
3e742018d6 memlogd: use net.Conn rather than *net.UnixConn
There's no need to be so specific about the connection implementation.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:49:25 +01:00
David Scott
c92af038fb projects/logging: promote pkg/memlogd to a toplevel package
This is an example external logging service which can be enabled by
adding it to the `init` section of the .yml, for example:

    ...
    init:
      - linuxkit/init:35866bb276c264a5f664bfac7456f4b9eeb87a4d
      - linuxkit/runc:v0.4
      - linuxkit/containerd:f2bc1bda1ab18146967fa1a149800aaf14bee81b
      - linuxkit/ca-certificates:v0.4
      - linuxkit/memlogd:cc035e5c9e4011ec1ba97a181a6689fc90965ce9
    onboot:
    ...

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:49:25 +01:00