Can I suppress logging certain rejected packets in the kernel log?

My ISP sends out a packet every minute that turns into a dmesg REJECT line:

[77120.748693] REJECT wan in: IN=eth2 OUT= MAC=ff:ff:ff:ff:ff:ff:b8:69:f4:84:35:4e:08:00 SRC=10.4.31.81 DST=255.255.255.255 LEN=165 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=41399 DPT=5678 LEN=145

This makes it very hard to find anything useful in the log. Can I arrange for these packets to be rejected silently while still logging other rejected packets?

You can supress such messages on firewall (using some “rule” to reject/drop such messages/packets) or syslog level (filter them using regexp or wildcards and log them to file or drop).

https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.21/administration-guide/55#TOPIC-1180572

https://openwrt.org/docs/guide-user/firewall/firewall_configuration#rules

I think that firewall approach is better as touching the filter in main syslog-ng can bring some other issues related to nikola.sh and parsing of iptables log file. If that message you want to supress is consistent in some values/pattern rule is very possibly the ideal way.

Aside “dmesg” is just buffer/cache in memory , so if this is just in dmesg output, you do not need to filter those at all, they are flushed on-fly …, if you want to keep the initial dmesg buffer after boot (so you can inspect it and see what is happening before syslog-ng hits in and during bootup, use /etc/rc.local and flush the dmesg buffrer to some file before syslog-ng discard that, resp. dmesg will fill it with new entries… ).

@Maxmilian_Picmaus Thank you. The openwrt pointer gave me enough context to create a drop rule. That seems to bypass all logging. Mission accomplished.