Skip to main content
Logs are generated by applications and system services, and they are categorized by facility and priority. Generating logs is only part of the story — you also need a reliable mechanism to collect, store, filter, and forward those logs so administrators can review and analyse them. Rsyslog is the common central logging service used to perform these tasks. Rsyslog receives syslog messages, evaluates them against configured selector rules, and then performs actions such as writing messages to disk, forwarding them to a remote collector, or delivering them to a local user. The two primary configuration locations are:
  • /etc/rsyslog.conf
  • /etc/rsyslog.d/*.conf
A flowchart titled "Rsyslog" showing applications and system services sending syslog messages to an Rsyslog service that writes logs to disk. It also shows Rsyslog checking configuration from /etc/rsyslog.d/*.conf and /etc/rsyslog.conf.
Usually, rsyslog writes messages to files under /var/log. Different subsystems are typically recorded to separate files (for example, authentication events to a different file than kernel messages). This separation makes it easier to filter, search and troubleshoot.

Selectors and priorities

Rsyslog filtering uses selectors formed as facility.priority. Explanation:
  • Facility — identifies the subsystem that generated the message (e.g., auth, mail, cron, user, kern, local0–local7).
  • Priority — indicates message severity. Common priorities include: debug, info, notice, warning, err (or error), crit, alert, emerg.
Table: common priorities and numeric equivalents You can combine selectors and modifiers. Examples:
  • *.info — log messages of info severity and higher from all facilities.
  • mail.none — exclude mail facility messages.
  • authpriv.* — all messages from the authpriv facility.

Example configuration snippet

Place this in /etc/rsyslog.d/myconfig.conf (or another .conf file in /etc/rsyslog.d/):

Where to look for logs

Common log files and their use cases:
A dark-themed slide titled "Viewing Logs" that highlights the log file path "/var/log/messages." It lists uses like general system events, logging services/applications, and first troubleshooting location, with "Logs are written" and "rsyslog" shown on the left.
Inspecting these files helps determine system activity, misconfigurations, or suspicious behavior.
Always place custom rsyslog configuration files in /etc/rsyslog.d/ and ensure the filename ends with .conf. After adding or modifying configuration, restart the rsyslog service so the new rules are loaded.

Demo: Create a custom rsyslog rules file

This demo shows how to create a custom rules file, reload rsyslog, and generate test messages with logger.
  1. Create /etc/rsyslog.d/mycustom.conf with the following content:
  1. Restart rsyslog to apply the new configuration:
  1. Generate test messages using logger:
  1. Verify the log files in /var/log:
View the logged messages:
If the messages appear in the expected files, your rules were applied correctly. Example trimmed session:

Troubleshooting tips

  • If rules don’t appear to take effect:
    • Check rsyslog service status and recent system log entries:
    • Confirm your custom file ends with .conf in /etc/rsyslog.d/ and contains valid syntax.
    • Use logger with different facilities and priorities to test individual rules.
  • When forwarding logs to a remote collector, ensure network connectivity and that the remote service accepts the configured transport (TCP/UDP/TLS).
Syntax errors or misconfigured selectors can cause messages to be misplaced or dropped. Always restart rsyslog after changes and verify your rules by generating test messages with logger.

Next steps and resources

With the basics covered, you can extend rsyslog to:
  • Forward logs to remote collectors (syslog over UDP/TCP, TLS).
  • Use templates for structured/log format customization.
  • Configure queues and rate-limiting for high-volume environments.
  • Integrate with log management solutions (Elastic Stack, Splunk, Graylog).
Useful references:

Watch Video