Este conteúdo não está disponível no idioma selecionado.
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 Copiar o linkLink copiado para a área de transferência!
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 |
13.2. Configuring persistent logging by using the journald System Role Copiar o linkLink copiado para a área de transferência!
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
journaldto 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
sudopermissions 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.ymlfile with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow As a result, the
journaldservice 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
# ansible-playbook --syntax-check playbook.yml -i inventory_fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook on your inventory file:
ansible-playbook -i inventory_file /path/to/file/playbook.yml
# ansible-playbook -i inventory_file /path/to/file/playbook.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
13.3. Additional resources Copiar o linkLink copiado para a área de transferência!
-
The
journald.conf(5)man page -
The
ansible-playbook(1)man page