From a62f3533819435cef7807f93ace11000c7230b15 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Tue, 18 Dec 2018 21:22:24 -0500 Subject: [PATCH] Override BEAT_LOG_OPTS in systemd unit file (#101) This overrides the defaults in the unit file for out services so that we get a log file. The tests currently assert that the log exists. We could extend the tests to assert that logs are written to journald in the future. Relates to https://github.com/elastic/beats/pull/8942 --- roles/test-beat/tasks/linux/main.yml | 12 ++++++++++++ roles/test-beat/templates/systemd.debug.conf | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 roles/test-beat/templates/systemd.debug.conf diff --git a/roles/test-beat/tasks/linux/main.yml b/roles/test-beat/tasks/linux/main.yml index 9857d1d..38935b5 100644 --- a/roles/test-beat/tasks/linux/main.yml +++ b/roles/test-beat/tasks/linux/main.yml @@ -25,6 +25,18 @@ dest: '{{ beat_cfg }}' mode: 0600 +- name: Create dir for systemd overrides + file: + path: '/etc/systemd/system/{{ beat_service_name }}.service.d' + state: directory + mode: 0755 + +- name: Override log options for systemd to get a log file + template: + src: systemd.debug.conf + dest: '/etc/systemd/system/{{ beat_service_name }}.service.d/debug.conf' + mode: 0600 + - name: 'Start {{ beat_service_name }} service' service: name: '{{ beat_service_name }}' diff --git a/roles/test-beat/templates/systemd.debug.conf b/roles/test-beat/templates/systemd.debug.conf new file mode 100644 index 0000000..017c088 --- /dev/null +++ b/roles/test-beat/templates/systemd.debug.conf @@ -0,0 +1,2 @@ +[Service] +Environment="BEAT_LOG_OPTS="