Compare commits

...

4 Commits

Author SHA1 Message Date
98be234a4f Merge pull request 'Configure maximum size and timespan of journald logs' (#594) from feature/506-journald_logs_config into master
Reviewed-on: #594
Reviewed-by: Râu Cao <raucao@kosmos.org>
2025-05-21 12:12:57 +00:00
Greg Karekinian
7dc4f674a0 Use the systemd unit instead of an execute resource
Also extract the attributes so it is possible to override them.
2025-05-21 13:40:12 +02:00
Greg Karekinian
49b636305e Update mastodon-3 node file after Chef run 2025-05-21 11:36:15 +02:00
Greg Karekinian
3e2ee30334 Configure maximum size and timespan of journald logs
Closes #506
2025-05-21 11:36:15 +02:00
5 changed files with 24 additions and 0 deletions

View File

@ -37,6 +37,7 @@
"timezone_iii::debian", "timezone_iii::debian",
"ntp::default", "ntp::default",
"ntp::apparmor", "ntp::apparmor",
"kosmos-base::journald_conf",
"kosmos-base::systemd_emails", "kosmos-base::systemd_emails",
"apt::unattended-upgrades", "apt::unattended-upgrades",
"kosmos-base::firewall", "kosmos-base::firewall",

View File

@ -0,0 +1,2 @@
node.default["kosmos-base"]["journald"]["system_max_use"] = "256M"
node.default["kosmos-base"]["journald"]["max_retention_sec"] = "7d"

View File

@ -27,6 +27,7 @@
include_recipe 'apt' include_recipe 'apt'
include_recipe 'timezone_iii' include_recipe 'timezone_iii'
include_recipe 'ntp' include_recipe 'ntp'
include_recipe 'kosmos-base::journald_conf'
include_recipe 'kosmos-base::systemd_emails' include_recipe 'kosmos-base::systemd_emails'
node.override["apt"]["unattended_upgrades"]["allowed_origins"] = [ node.override["apt"]["unattended_upgrades"]["allowed_origins"] = [

View File

@ -0,0 +1,14 @@
#
# Cookbook Name:: kosmos-base
# Recipe:: journald_conf
#
service "systemd-journald"
template "/etc/systemd/journald.conf" do
source "journald.conf.erb"
variables system_max_use: node["kosmos-base"]["journald"]["system_max_use"],
max_retention_sec: node["kosmos-base"]["journald"]["max_retention_sec"]
# Restarting journald is required
notifies :restart, "service[systemd-journald]", :delayed
end

View File

@ -0,0 +1,6 @@
[Journal]
# Set the maximum size of the journal logs in bytes
SystemMaxUse=<%= @system_max_use %>
# Set the number of days after which logs will be deleted
MaxRetentionSec=<%= @max_retention_sec %>