Skip to content

Commit 9eed717

Browse files
committed
Enable persistent journaling
In the cloud images, /var/log/journal doesn't exist. When this directory does not exist, journald will not write any files to disk, and as such, logging data is lost accross reboots. Persistent logging is useful for debugging issues that caused the nodes to reboot (provided that the logs are flushed to disk).
1 parent 98ed51b commit 9eed717

File tree

7 files changed

+59
-1
lines changed

7 files changed

+59
-1
lines changed

ansible/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,5 @@ roles/*
9898
!roles/eessi/**
9999
!roles/topology/
100100
!roles/topology/**
101+
!roles/journald/
102+
!roles/journald/**

ansible/bootstrap.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
to update these variable names. ** NB: The actual secrets will not be changed.**
2929
when: "'secrets_openhpc_' in (hostvars[inventory_hostname] | join)"
3030

31+
- hosts: journald
32+
gather_facts: false
33+
tags:
34+
- logging
35+
- journald
36+
tasks:
37+
- import_role:
38+
name: journald
39+
3140
- hosts: resolv_conf
3241
become: yes
3342
gather_facts: false

ansible/roles/journald/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# journald
2+
3+
This role is used to configue journald. Please see the [role
4+
defaults](defaults/main.yml) for a full list of configuration options.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
# Journald storage. One of: volatile, persistent, auto, or none. Defaults to
3+
# `persistent`.
4+
journald_storage: persistent
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
- name: Create /var/log/journal
3+
become: true
4+
file:
5+
path: /var/log/journal
6+
owner: "root"
7+
group: "systemd-journal"
8+
mode: 02755
9+
state: directory
10+
notify: Flush journal to disk
11+
when: journald_storage == "persistent"
12+
13+
- name: Ensure journald drop in directory exists
14+
file:
15+
path: "/etc/systemd/journald.conf.d/"
16+
owner: "root"
17+
group: "root"
18+
mode: 0770
19+
state: directory
20+
become: true
21+
22+
- name: Ensure journald.conf overrides are set
23+
copy:
24+
content: |
25+
[Journal]
26+
Storage={{ journald_storage }}
27+
dest: /etc/systemd/journald.conf.d/ansible-slurm-appliance.conf
28+
owner: root
29+
group: root
30+
mode: 0660
31+
become: true
32+
notify: Restart journald

docs/monitoring-and-logging.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ slurm-stats is configured `slurm-stats` role in the [slurm_openstack_tools colle
301301
The `slurm_stats` group controls the placement of the `slurm_stats` service.
302302
This should be configured to be a group with a single host. That host must be co-located on the same host as the `filebeat` service that scrapes its output.
303303

304+
## Logging configuration
304305

306+
### Journald
305307

306-
308+
The [journald](../ansible/roles/journald/README.md) role is used to customise
309+
journald configuration.

environments/common/inventory/groups

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ login
2626
openhpc
2727
additional
2828

29+
[journald:childen]
30+
# Hosts where journald should be configured. See ansible/roles/journald/README.md.
31+
cluster
32+
2933
[builder]
3034
# Do not add hosts here manually - used as part of Packer image build pipeline. See packer/README.md.
3135

0 commit comments

Comments
 (0)