Updated: 11 October 2026 · Applies to: rsyslog 8 on AlmaLinux 9, Rocky Linux 9, Ubuntu 24.04 and Debian 12

rsyslog can drop unwanted messages or send them to a separate file, based on their content or program name.

Examples

Create /etc/rsyslog.d/10-filters.conf:

# discard messages containing this text
:msg, contains, "unwanted text" stop

# send messages from one program to its own file, then stop
:programname, isequal, "myapp" /var/log/myapp.log
& stop

Restart rsyslog: systemctl restart rsyslog. The old ~ discard action still works but stop is the current syntax.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket