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

parse syslog #501

Merged
merged 3 commits into from
Oct 21, 2024
Merged

parse syslog #501

merged 3 commits into from
Oct 21, 2024

Conversation

aluedeke
Copy link
Collaborator

parse all fields from the syslog into dedicated json fields when passing --parse so filtering gets easier
stick to the legacy formats if nothing is passed or json disabled
the timestamp handling is really ugly as syslog doesn't provide the year 🤯 nor the timezone

}
}()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c
}

func rawSyslog(log string) string {
Copy link
Owner

Choose a reason for hiding this comment

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

can you abye move this logic out of the main and to the syslog package?
If someone wants to use this from the API later or just as a module having it in main.go is kind of an antipattern.
And yes, I know I am guilty of this myself :-D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i would not move the raw and legacy parser anywhere, raw doesn't do anything and the legacy json parser is pretty much useless ;) so offering the proper parser for reuse makes sense everything else should be hidden, could even be marked as deprecated. Let me know if that makes sense

Copy link
Owner

Choose a reason for hiding this comment

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

oh yeah. Now I see it. Thanks for explaining!

@danielpaulus danielpaulus merged commit 55deb23 into danielpaulus:main Oct 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants