From b3fb995cd54cee22f8f3ddcb79eabc5b643ae248 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Fri, 6 Jul 2018 15:11:17 +0000 Subject: [PATCH] Only pass journal dirs that are present to Journalbeat Change-Id: I3e65a0a06c452632847a55effd2ce4d0c3cb4ac0 --- elk_metrics_6x/installJournalbeat.yml | 5 +++++ elk_metrics_6x/templates/journalbeat.yml.j2 | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/elk_metrics_6x/installJournalbeat.yml b/elk_metrics_6x/installJournalbeat.yml index 591c664e..8284a843 100644 --- a/elk_metrics_6x/installJournalbeat.yml +++ b/elk_metrics_6x/installJournalbeat.yml @@ -32,6 +32,11 @@ tasks: - include_tasks: common_task_install_go1.10.1.yml + - name: Check for journal directory + stat: + path: /var/log/journal + register: journal_dir + - name: Ensure libsystemd-dev is installed apt: name: "{{ item }}" diff --git a/elk_metrics_6x/templates/journalbeat.yml.j2 b/elk_metrics_6x/templates/journalbeat.yml.j2 index 808d7cb9..6befe275 100644 --- a/elk_metrics_6x/templates/journalbeat.yml.j2 +++ b/elk_metrics_6x/templates/journalbeat.yml.j2 @@ -68,8 +68,9 @@ journalbeat: # If you want to open Journal from directory just pass an array consisting of one element # representing the path. See: https://www.freedesktop.org/software/systemd/man/sd_journal_open.html # By default this setting is empty thus journalbeat will attempt to find all journal files automatically +{% if journal_dir.stat.exists and journal_dir.stat.isdir %} journal_paths: ["/var/log/journal"] - +{% endif %} #default_type: journal #================================ General ======================================