Stop firewalld logging to kernel ring buffer/dmesg.
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Stop firewalld logging to kernel ring buffer/dmesg.
When I run dmesg it is flooded with dropped or rejected messages. I want to keep the logs, but not log to the kernel ring buffer such that dmesg would read it. I created a file /etc/rsyslog.d/firewalld-droppd.conf and then restarted rsyslog so that firewall messages go to a separate file. The contents of the config:
But this most likely didn't disable writing to kernel ring buffer because when I run dmesg I still get recent REJECT and DROP messages. /var/log/messages don't contain these recent messages. How do I stop firewalld or rsyslogd from logging to the kernel ring buffer? I am trying to do this on Fedora 37.
It looks like, according to https://github.com/firewalld/firewalld/issues/984 (if I'm understanding it correctly), that firewalld currently only logs deny messages to kernel ring buffer and there currently isn't an option to log to a different target. So it seems that there is no way to configure firewalld to log to rsyslog or other. In the mean time I'm open to any ideas on how to intercept and block global/individual application writes or reads to/from /dev/kmsg, /proc/kmsg, and/or other devices that fall under the umbrella that is "kernel ring buffer" as referenced by the dmesg documentation.
On the contrary, it looks like the fix mentioned by @Talkless on Sept 12, 2022 added precisely what you are wanting.
@TorontoMedia replied saying that only affects logging in the daemon and not packets. I tried --log-target=rsyslog and it failed to start. I tried --log-target=syslog and it still logs to ring buffer. --log-target=file logs to default log file /var/log/firewalld and, like @TorontoMedia said, only shows logs from daemon and not packets. --set-log-denied is for firewall-cmd and is just setting what kind of packets gets logged with values all, unicast, broadcast, multicast, and off and no log target.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.