draios / sysdig

Linux system exploration and troubleshooting tool with first class support for containers
http://www.sysdig.com/
Other
7.8k stars 728 forks source link

Add --log-level flag #1871

Closed alban closed 2 years ago

alban commented 2 years ago

Add --log-level flag

To debug problems with missing container metadata, it is useful to enable debugs and select the log-level.

How to use

Use -D and --log-level together. For example:

sysdig -D --log-level=trace --bpf=/ebpf/sysdig-ebpf.o evt.type=execve -p"*{%container.id %container.image %proc.cmdline}"

Testing done

I tested this on the 0.27.0 branch first. Example of commands:

# sysdig -D --log-level=xx
invalid log level xx
# sysdig -D --log-level=warning --bpf=/ebpf/sysdig-ebpf.o evt.type=execve -p"*{%container.id %container.image %proc.cmdline}"
# sysdig -D --log-level=debug --bpf=/ebpf/sysdig-ebpf.o evt.type=execve -p"*{%container.id %container.image %proc.cmdline}"
...
04-27 14:13:13.847061 cri_async (9c3993d24990): Source dequeued key
04-27 14:13:13.847851 cri (9c3993d24990): Status from ContainerStatus: ()
04-27 14:13:13.849512 cri_async (9c3993d24990): Parse successful, storing value
04-27 14:13:13.849531 cri_async (9c3993d24990): Source callback result=1
04-27 14:13:13.849630 notify_new_container (9c3993d24990): created CONTAINER_JSON event, queuing to inspector

Signed-off-by: Alban Crequy albancrequy@microsoft.com

FedeDP commented 2 years ago

Moreover, why did CI not trigger here?

LucaGuerra commented 2 years ago

The PR looks good to me, but I also have no idea why GitHub Actions didn't trigger

FedeDP commented 2 years ago

lgtm, let's see if GHA notices it...

aand it didn't :laughing:

LucaGuerra commented 2 years ago

We'll trust you @alban even if GitHub Actions didn't notice you :smile: