From dffb57e2fcfc36da1db394b068767838d148d738 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Mon, 10 Jan 2022 15:27:03 +0900 Subject: [PATCH] Add `rsyslog` config for `nomad`. --- cookbooks/nomad/files/etc/rsyslog.d/30-nomad.conf | 7 +++++++ cookbooks/nomad/setup.rb | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 cookbooks/nomad/files/etc/rsyslog.d/30-nomad.conf diff --git a/cookbooks/nomad/files/etc/rsyslog.d/30-nomad.conf b/cookbooks/nomad/files/etc/rsyslog.d/30-nomad.conf new file mode 100644 index 0000000..9c26961 --- /dev/null +++ b/cookbooks/nomad/files/etc/rsyslog.d/30-nomad.conf @@ -0,0 +1,7 @@ +# Log kernel generated promtail log messages to file +:syslogtag,contains,"nomad" /var/log/nomad.log + +# Uncomment the following to stop logging anything that matches the last rule. +# Doing this will stop logging kernel generated UFW log messages to the file +# normally containing kern.* messages (eg, /var/log/kern.log) +& stop diff --git a/cookbooks/nomad/setup.rb b/cookbooks/nomad/setup.rb index a2a5bcd..2f2ddea 100644 --- a/cookbooks/nomad/setup.rb +++ b/cookbooks/nomad/setup.rb @@ -91,3 +91,15 @@ end service 'promtail-nomad' do action [ :enable, :restart ] end + +remote_file '/etc/rsyslog.d/30-nomad.conf' do + owner 'root' + group 'root' + mode '644' + + notifies :restart, 'service[rsyslog]' +end + +service 'rsyslog' do + action [ :nothing ] +end