1

I started to learn Linux not long ago and have read some instructions about systemd and journald.

My question is: Is systemctl edit systemd-journald a proper way to configure systemd-journald.service?

According to the man page of journald.conf.d, we can put configuration files in these directories:

/etc/systemd/journald.conf

/etc/systemd/journald.conf.d/*.conf

/run/systemd/journald.conf.d/*.conf

/usr/lib/systemd/journald.conf.d/*.conf

/usr/local/lib/systemd/*.conf.d/

I also noticed that systemctl edit systemd-journald would create /etc/systemd/system/systemd-journald.service.d/override.conf to override the defaults for systemd-journald.service which is not mentioned in the man page above.

Is it a proper way to configure systemd-journald.service? What are the differences between all these directories?

krave
  • 1,629
  • 4
  • 17
  • 36

1 Answers1

1

Is systemctl edit systemd-journald a proper way to configure systemd-journald.service?

No. This command allows to change the service definition, not the service configuration.

The service definition contains information that systemd requires to run a service, and not the configuration of the service. The default service definition file is usually located in a lib directory, e.g. /usr/lib/systemd/system/systemd-journald.service. The command systemctl edit systemd-journald allows to override values from this definition. It will create a file /etc/systemd/system/systemd-journald.service.d/override.conf that contains only values that differ from the service definition.

The preferred way to edit the journald configuration is to create a file with the suffix .conf in the directory /etc/systemd/journald.conf.d, e.g. /etc/systemd/journald.conf.d/50-local.conf. This file may contain your configuration. For example, to make your journal persistent, the file should contain:

[Journal]
Storage=persistent

An alternative would be to edit the file /etc/systemd/journald.conf. But this solution has one drawback: whenever a systemd update brings a new default configuration file, you're asked to merge your changes with the new default config.

Files within /usr/lib and /usr/local/lib are usually the place for files from your linux distribution and not for user configuration. Files within /run contain working data for running processes and not persistent configurations.

Further details may be found in the man page of journald.conf.

jack
  • 126
  • 5