8000 [FEAT] logger: debug output enrichment by geyslan · Pull Request #2254 · aquasecurity/tracee · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[FEAT] logger: debug output enrichment #2254

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

Merged
merged 2 commits into from
Nov 16, 2022

Conversation

geyslan
Copy link
Member
@geyslan geyslan commented Oct 19, 2022

Initial Checklist

  • There is an issue describing the need for this PR.
  • Git log contains summary of the change.
  • Git log contains motivation and context of the change.

Description (git log)

72c3828 logger: enrich debug level logs
ffa109a logger: refactor

Fixes: #2248

Type of change

  • Code refactor (code improvement and/or code removal)
  • New feature (non-breaking change adding functionality).

How Has This Been Tested?

❯ sudo TRACEE_LOGGER_LVL=debug ./dist/tracee-ebpf -t comm=ls
{"level":"debug","ts":1666192669.9143562,"msg":"osinfo","pkg":"main","file":"main.go","line":85,"OSReleaseField":"BUILD_ID","OS_KERNEL_RELEASE":"rolling"}
{"level":"debug","ts":1666192669.9146245,"msg":"osinfo","pkg":"main","file":"main.go","line":85,"OSReleaseField":"PRETTY_NAME","OS_KERNEL_RELEASE":"\"Manjaro Linux\""}
{"level":"debug","ts":1666192669.9146755,"msg":"osinfo","pkg":"main","file":"main.go","line":85,"OSReleaseField":"KERNEL_RELEASE","OS_KERNEL_RELEASE":"5.15.74-3-MANJARO"}
{"level":"debug","ts":1666192669.9147034,"msg":"osinfo","pkg":"main","file":"main.go","line":85,"OSReleaseField":"ARCH","OS_KERNEL_RELEASE":"x86_64"}
{"level":"debug","ts":1666192669.9147112,"msg":"osinfo","pkg":"main","file":"main.go","line":85,"OSReleaseField":"ID","OS_KERNEL_RELEASE":"manjaro"}
{"level":"debug","ts":1666192669.9147198,"msg":"osinfo","pkg":"main","file":"main.go","line":85,"OSReleaseField":"ID_LIKE","OS_KERNEL_RELEASE":"arch"}
{"level":"debug","ts":1666192669.9160993,"msg":"osinfo","pkg":"main","file":"main.go","line":152,"security_lockdown":"none"}
TIME             UID    COMM             PID     TID     RET              EVENT                ARGS

Remove redundant condition and make use of
isAggregateSetAndIsLogNotNew() function.
Debug level logs now have pkg, file, line key/values prepended.
Copy link
Contributor
@josedonizetti josedonizetti left a comment

Choose a reason for hiding this comment

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

@geyslan why export CallerInfo, CallerPackage, and CallerFile if no one is using it?

@geyslan
Copy link
Member Author
geyslan commented Oct 19, 2022

@geyslan why export CallerInfo, CallerPackage, and CallerFile if no one is using it?

@josedonizetti

After our yesterday discussion, I thought that even if not at debug level the user of the logger could want to use this information as key/values for a Info or Warn level like:

logger.Warn("not expected behaviour", "line", logger.CallerLine())

I know, it's a information intrinsic to debug level, however, if one needs it, it's available now for any case. Let me know what you both think. @rafaeldtinoco

@geyslan geyslan requested a review from yanivagman October 26, 2022 15:47
@geyslan geyslan added this to the v0.10.0 milestone Nov 3, 2022
Copy link
Contributor
@josedonizetti josedonizetti left a comment

Choose a reason for hiding this comment

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

@geyslan IMO we should not try to predict what funcs will be needed, and add methods as the necessity appears, if we ever need those methods for a use case, we add them. But if others agree with adding them here, no problem for me. :)

@geyslan
Copy link
Member Author
geyslan commented Nov 8, 2022

@geyslan IMO we should not try to predict what funcs will be needed, and add methods as the necessity appears, if we ever need those methods for a use case, we add them. But if others agree with adding them here, no problem for me. :)

I agree with you. As this is not a priority, I would like to wait others to state about it before merge or remove the CallerInfo(), CallerPackage(), CallerFile() and CallerLine().

Thanks for reviewing this.

@geyslan geyslan closed this Nov 16, 2022
@geyslan geyslan reopened this Nov 16, 2022
@geyslan
Copy link
Member Author
geyslan commented Nov 16, 2022

@geyslan IMO we should not try to predict what funcs will be needed, and add methods as the necessity appears, if we ever need those methods for a use case, we add them. But if others agree with adding them here, no problem for me. :)

I agree with you. As this is not a priority, I would like to wait others to state about it before merge or remove the CallerInfo(), CallerPackage(), CallerFile() and CallerLine().

Thanks for reviewing this.

As there was no feedback, I'm going to remove that helpers.

@geyslan geyslan merged commit ea71dfc into aquasecurity:main Nov 16, 2022
@geyslan geyslan deleted the 2248-logger-enrich branch May 29, 2023 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] logger: output origin as key/value
2 participants
0