Only pass journal dirs that are present to Journalbeat

Change-Id: I3e65a0a06c452632847a55effd2ce4d0c3cb4ac0
This commit is contained in:
Jonathan Rosser 2018-07-06 15:11:17 +00:00 committed by Jonathan Rosser
parent b0654ee8e5
commit b3fb995cd5
2 changed files with 7 additions and 1 deletions

View File

@ -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 }}"

View File

@ -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 ======================================