Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logger: fix callback log level and output #312

Merged
merged 2 commits into from
Apr 6, 2023

Conversation

geyslan
Copy link
Member

@geyslan geyslan commented Mar 29, 2023

commit e99ef72

logger: pass raw libbpf print output

Due to libbpf output being escaped, we should pass the raw output to the
consumer, letting them decide how to format it, since them might want
to, for example, use it in a logger or print directly to stderr.

Reported-by: @yanivagman

commit 9f21a9d

logger: fix callback log level

Fixes: #311
Fixes: #313

@geyslan geyslan added the bug Something isn't working label Mar 29, 2023
@geyslan geyslan self-assigned this Mar 29, 2023
yanivagman
yanivagman previously approved these changes Mar 30, 2023
Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@geyslan geyslan changed the title logger: fix callback log level logger: fix callback log level and output Mar 30, 2023
@geyslan

This comment was marked as outdated.

@geyslan
Copy link
Member Author

geyslan commented Mar 30, 2023

@yanivagman I guess we can't output it as literal strings (to be used by a json structured logger): uber-go/zap#963 (comment)


In the lib we must pass the original output via callbacks. The consumer is who decides how to unescape, trim... and print it.

If you agree, I'll remove the commit d0119cf, leaving the original one that fixes the level issue, so we can discuss how to tackle the output on tracee.

--- EDIT

After discussion, we decided to provide a raw output string for callbacks.

Due to libbpf output being escaped, we should pass the raw output to the
consumer, letting them decide how to format it, since them might want
to, for example, use it in a logger or print directly to stderr.

Reported-by: @yanivagman
@geyslan geyslan added the break Breaking change label Mar 31, 2023
@geyslan geyslan merged commit 6d17d1a into aquasecurity:main Apr 6, 2023
@geyslan geyslan deleted the 311-log-level branch May 29, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
break Breaking change bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

log callback is passing escaped output log callback isn't passing the right output level
2 participants