Questo contenuto non è disponibile nella lingua selezionata.
Chapter 13. Configuring the systemd journal by using the journald RHEL System Role
With the journald
System Role you can automate the systemd
journal, and configure persistent logging by using the Red Hat Ansible Automation Platform.
13.1. Variables for the journald
RHEL System Role
The journald
System Role provides a set of variables for customizing the behavior of journald
logging service. The role includes the following variables:
Role Variable | Description |
---|---|
|
Use this boolean variable to configure |
|
Use this variable to specify the maximum size, in megabytes, that journal files can occupy on disk. Refer to the default sizing calculation described in |
|
Use this variable to specify the maximum number of journal files you want to keep while respecting the |
| Use this variable to specify the maximum size, in megabytes, of a single journal file. |
|
Use this boolean variable to configure |
|
Use this boolean variable to apply compression to |
|
Use this variable to specify the time, in minutes, after which |
Additional resources
-
The
journald.conf(5)
man page.
13.2. Configuring persistent logging by using the journald
System Role
As a system administrator, you can configure persistent logging by using the journald
System Role. The following example shows how to set up the journald
System Role variables in a playbook to achieve the following goals:
- Configuring persistent logging
- Specifying the maximum size of disk space for journal files
-
Configuring
journald
to keep log data separate for each user - Defining the synchronization interval
Prerequisites
- You have prepared the control node and the managed nodes
- You are logged in to the control node as a user who can run playbooks on the managed nodes.
-
The account you use to connect to the managed nodes has
sudo
permissions on them. - The managed nodes or groups of managed nodes on which you want to run this playbook are listed in the Ansible inventory file.
Procedure
Create a new
playbook.yml
file with the following content:--- - hosts: all vars: journald_persistent: true journald_max_disk_size: 2048 journald_per_user: true journald_sync_interval: 1 roles: - linux-system-roles.journald ---
As a result, the
journald
service stores your logs persistently on a disk to the maximum size of 2048 MB, and keeps log data separate for each user. The synchronization happens every minute.Optional: Verify playbook syntax.
# ansible-playbook --syntax-check playbook.yml -i inventory_file
Run the playbook on your inventory file:
# ansible-playbook -i inventory_file /path/to/file/playbook.yml
13.3. Additional resources
-
The
journald.conf(5)
man page -
The
ansible-playbook(1)
man page