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

Clamd and freshclam logs JSON format #66

Open
Pophalekiran opened this issue Oct 22, 2024 · 4 comments
Open

Clamd and freshclam logs JSON format #66

Pophalekiran opened this issue Oct 22, 2024 · 4 comments

Comments

@Pophalekiran
Copy link

Hello Team,

I am using clamav 1.3 image, deployed it in Kubernetes env, I wanted to collect or stdout logs in JSON format. I tried various options but none of it worked for me.

I have create the image with Dockerfile as

FROM clamav/clamav:1.3
ENTRYPOINT ["/init-unprivileged"]

I suspect that init-unprivileged scripts redirecting the logs to STDOUT channel. But no sure 100 %.

Can you please guide me to get the logs in JSON format, it will be very simple JSON.

for example "{"timestamp": "$timestamp", "message": "$line"}"

If this is not possible then is there way to stop printing logs on STDOT completely

@micahsnyder
Copy link
Collaborator

Outputting log lines as json objects is not something clamav can do.

The only way that I can think of to completely silence freshclam or clamd is to redirect stdout and stderr for each process to /dev/null in the init script.

@Pophalekiran
Copy link
Author

Thank you. I am very new to ClamAV configuration. Could please help with probable changes in scripts

@micahsnyder
Copy link
Collaborator

Sorry about the delayed reply. What I'm suggesting is you would change any calls to clamd or freshclam to be something like:
clamd --foreground > /dev/null 2>&1 &
or
freshclam --foreground > /dev/null 2>&1 &

I'm still kind of confused why you'd want to silence all log messages from these. But if you want to do it, that's how I think you'd have to do it.

@micahsnyder
Copy link
Collaborator

@Pophalekiran I just read this comment where someone shared how they use syslog-ng to print logs in JSON format. I immediately though to share with you Cisco-Talos/clamav#1371 (comment)

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

No branches or pull requests

2 participants