mirror of
https://github.com/containers/podman.git
synced 2025-10-17 03:04:21 +08:00
podman logs passthrough driver support --cgroups=split
When run with --cgroups=split mode (e.g. quadlet) we do not use the a separate cgroup for the container and just run in the unit cgroup. When we filter logs we thus must match the unit name. Added a small test to the quadlet test to make sure it will work. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -38,14 +38,14 @@ func (c *Container) ReadLog(ctx context.Context, options *logs.LogOptions, logCh
|
||||
switch c.LogDriver() {
|
||||
case define.PassthroughLogging:
|
||||
// if running under systemd fallback to a more native journald reading
|
||||
if _, ok := c.config.Labels[systemdDefine.EnvVariable]; ok {
|
||||
return c.readFromJournal(ctx, options, logChannel, colorID, true)
|
||||
if unitName, ok := c.config.Labels[systemdDefine.EnvVariable]; ok {
|
||||
return c.readFromJournal(ctx, options, logChannel, colorID, unitName)
|
||||
}
|
||||
return fmt.Errorf("this container is using the 'passthrough' log driver, cannot read logs: %w", define.ErrNoLogs)
|
||||
case define.NoLogging:
|
||||
return fmt.Errorf("this container is using the 'none' log driver, cannot read logs: %w", define.ErrNoLogs)
|
||||
case define.JournaldLogging:
|
||||
return c.readFromJournal(ctx, options, logChannel, colorID, false)
|
||||
return c.readFromJournal(ctx, options, logChannel, colorID, "")
|
||||
case define.JSONLogging:
|
||||
// TODO provide a separate implementation of this when Conmon
|
||||
// has support.
|
||||
|
Reference in New Issue
Block a user