rsyslog filter - stop not discarding

mstefan

Member
Jan 3, 2022
24
8
8
33
Hello,

I am trying to tidy up my syslog on lates pve (7.3-4).
Therefore i edited the /etc/rsyslog.conf and added the following before the # RULES # section.
(I already tried on other positions, nothing changed)
Bash:
if ($programname contains "root") then {
  action(type="omfile" file="/mnt/log.log")
  stop
}

I tested with logger "test".
The logentry is written to the destination file but the "stop" is ignored. (tried with &stop aswell)
It is also placed in syslog.

Do it get sth wrong here?
 
just tried reproducing this - it works here (also latest versions) - the messages are logged to the /mnt/log.log, but not to /var/log/syslog

(just copied your snippet above the RULES section - after reading the rsyslog docs and agreeing that it seems correct)

The one thing that was surprising was that running `logger` in my graphic session always kept my username (even though I used `su` and `sudo` - maybe this was the issue for you as well?)

and just to be sure - the messages will end up in the journal in any case (journald forwards the messages to syslog ) - so check /var/log/syslog - and not journalctl

I hope this helps!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!