Skip to content

Best 100 Tools

Best 100 Tools – Independent Software Reviews by Administrators… for Administrators

Primary Menu
  • Home
  • Best 100 Tools
  • 6 System Logging Configurations with rsyslog
  • Best 100 Tools

6 System Logging Configurations with rsyslog

Paul July 26, 2025
6-System-Logging-Configurations-with-rsyslog-1

System Logging Configuration with Rsyslog: A Detailed Guide

System logging is an essential aspect of system administration, providing valuable insights into system activity and enabling administrators to troubleshoot issues quickly. Rsyslog is a popular open-source system logging tool that provides powerful features for managing log messages across various systems. In this article, we will explore six common system logging configurations with rsyslog.

Prerequisites

Before diving into the configurations, ensure you have:

  • Rsyslog installed on your system (version 5.x or later)
  • Basic understanding of rsyslog configuration syntax and concepts
  • Familiarity with Linux command-line interface and terminal navigation

Configuration 1: Simple System Logging

The first configuration is a basic setup for collecting log messages from all systems. This configuration will work as an initial step before implementing more advanced configurations.

Step 1: Create the rsyslog configuration file

bash
sudo nano /etc/rsyslog.conf

Add the following lines to the end of the file:

“`

Configuration for simple system logging

.;auth,authpriv.4 /var/log/messages
“`

Restart the rsyslog service for changes to take effect.

Step 2: Verify configuration

bash
sudo service rsyslog restart

The above configuration will write log messages from all facilities (kernel, user, etc.) and priorities (info, warn, error) to the /var/log/messages file. The auth and authpriv facilities are also written with a priority of 4.

Configuration 2: Advanced System Logging

This configuration builds upon the previous one by specifying more detailed logging rules.

Step 1: Update the rsyslog configuration file

bash
sudo nano /etc/rsyslog.conf

Add the following lines to the end of the file:

“`

Configuration for advanced system logging

kern.info /var/log/kern.log
kern.warn /var/log/warn.log
user. /var/log/user.log
mail.
/var/log/mail.log
news. /var/log/news.log
local4.
/var/log/local4.log
auth,authpriv.4 /var/log/auth.log
“`

Restart the rsyslog service for changes to take effect.

Step 2: Verify configuration

bash
sudo service rsyslog restart

The above configuration will write log messages from various facilities and priorities to specific log files. The kern facility has separate logs for info and warn messages, while the user, mail, news, and local4 facilities have a single log file each.

Configuration 3: Using Templates

Templates allow you to format your log messages in various ways.

Step 1: Create a template file

bash
sudo nano /etc/rsyslog.d/templates.conf

Add the following lines:

template(name="Template1" type="string"
string="/var/log/%H-%y.log")

Restart the rsyslog service for changes to take effect.

Step 2: Update the main configuration file

bash
sudo nano /etc/rsyslog.conf

Add the following lines:

“`
template (name=”Template1″ type=”string”
string=”/var/log/%H-%y.log”)

kern.info Template1
kern.warn Template1
user. Template1
mail.
Template1
news. Template1
local4.
Template1
auth,authpriv.4 Template1
“`

Restart the rsyslog service for changes to take effect.

Step 3: Verify configuration

bash
sudo service rsyslog restart

The above configuration will write log messages from various facilities and priorities to a single template file with the format hostname-year.log.

Configuration 4: Using Facilities

Facilities provide a way to categorize your log messages.

Step 1: Update the main configuration file

bash
sudo nano /etc/rsyslog.conf

Add the following lines:

“`

Configuration for facilities

.info;mail.none;auth,authpriv.none /var/log/messages
kern.info /var/log/kern.log
kern.warn /var/log/warn.log
user.
/var/log/user.log
mail. /var/log/mail.log
news.
/var/log/news.log
local4.* /var/log/local4.log
auth,authpriv.4 /var/log/auth.log
“`

Restart the rsyslog service for changes to take effect.

Step 2: Verify configuration

bash
sudo service rsyslog restart

The above configuration will write log messages from all facilities except mail and auth, authpriv with priority 4. The remaining facilities are written to their respective log files.

Configuration 5: Using Priorities

Priorities provide a way to categorize your log messages based on severity.

Step 1: Update the main configuration file

bash
sudo nano /etc/rsyslog.conf

Add the following lines:

“`

Configuration for priorities

.info;mail.none;auth,authpriv.none /var/log/messages
kern.
;mail.none;auth,authpriv.none /var/log/kern.log
user.;mail.none;auth,authpriv.none /var/log/user.log
news.
;mail.none;auth,authpriv.none /var/log/news.log
local4.*;mail.none;auth,authpriv.none /var/log/local4.log
kern.warning;mail.none;auth,authpriv.none /var/log/warn.log
“`

Restart the rsyslog service for changes to take effect.

Step 2: Verify configuration

bash
sudo service rsyslog restart

The above configuration will write log messages from various facilities and priorities. The kern facility has separate logs for all priorities except warning, which is written to a single log file.

Configuration 6: Using IP Address

IP addresses provide a way to filter your log messages based on the source of the message.

Step 1: Update the main configuration file

bash
sudo nano /etc/rsyslog.conf

Add the following lines:

“`

Configuration for IP address

192.168.0.100.* /var/log/ip.log
!192.168.0.100 # exclude messages from this IP address
“`

Restart the rsyslog service for changes to take effect.

Step 2: Verify configuration

bash
sudo service rsyslog restart

The above configuration will write log messages from the specified IP address to a single log file, while excluding messages from that IP address.

In conclusion, these six system logging configurations with rsyslog provide various ways to manage and filter your log messages. Remember to update the main rsyslog configuration file and restart the service for changes to take effect.

About the Author

Paul

Administrator

Visit Website View All Posts
Post Views: 73

Post navigation

Previous: 18 Scikit-Learn Pipeline Techniques for Data Scientists
Next: 10 Fail2Ban Configurations for Enhanced Security

Related Stories

17-ELK-Stack-Configurations-for-System-Monitoring-1
  • Best 100 Tools

17 ELK Stack Configurations for System Monitoring

Paul September 28, 2025
13-Ubuntu-Performance-Optimization-Techniques-1
  • Best 100 Tools

13 Ubuntu Performance Optimization Techniques

Paul September 27, 2025
20-Fail2Ban-Configurations-for-Enhanced-Security-1
  • Best 100 Tools

20 Fail2Ban Configurations for Enhanced Security

Paul September 26, 2025

Recent Posts

  • 17 ELK Stack Configurations for System Monitoring
  • 13 Ubuntu Performance Optimization Techniques
  • 20 Fail2Ban Configurations for Enhanced Security
  • 5 AWS CI/CD Pipeline Implementation Strategies
  • 13 System Logging Configurations with rsyslog

Recent Comments

  • sysop on Notepadqq – a good little editor!
  • rajvir samrai on Steam – A must for gamers

Categories

  • AI & Machine Learning Tools
  • Aptana Studio
  • Automation Tools
  • Best 100 Tools
  • Cloud Backup Services
  • Cloud Computing Platforms
  • Cloud Hosting
  • Cloud Storage Providers
  • Cloud Storage Services
  • Code Editors
  • Dropbox
  • Eclipse
  • HxD
  • Notepad++
  • Notepadqq
  • Operating Systems
  • Security & Privacy Software
  • SHAREX
  • Steam
  • Superpower
  • The best category for this post is:
  • Ubuntu
  • Unreal Engine 4

You may have missed

17-ELK-Stack-Configurations-for-System-Monitoring-1
  • Best 100 Tools

17 ELK Stack Configurations for System Monitoring

Paul September 28, 2025
13-Ubuntu-Performance-Optimization-Techniques-1
  • Best 100 Tools

13 Ubuntu Performance Optimization Techniques

Paul September 27, 2025
20-Fail2Ban-Configurations-for-Enhanced-Security-1
  • Best 100 Tools

20 Fail2Ban Configurations for Enhanced Security

Paul September 26, 2025
5-AWS-CICD-Pipeline-Implementation-Strategies-1
  • Best 100 Tools

5 AWS CI/CD Pipeline Implementation Strategies

Paul September 25, 2025
Copyright © All rights reserved. | MoreNews by AF themes.