{#
include:
  - .beaver

#}

{% macro logship(appshort, logfile, type='daemon', tags=['daemon','error'], format='json', delimiter='\\\\n') -%}
{% if salt['pillar.get']('monitoring:enabled', True) %}

{% set tags = ','.join(tags) %}

/etc/beaver.d/{{appshort}}.conf:
  file:
    - managed
    - source: salt://logstash/templates/beaver/beaver-file.conf
    - template: jinja
    - context:
      logfile: {{logfile}}
      format: {{format}}
      type: {{type}}
      tags: {{tags}}
      delimiter: "{{delimiter}}"
    - watch_in:
      - service: beaver
    - require:
      - file: /etc/beaver.d

{% endif %}
{%- endmacro %}

{#
include:
  - .beaver

#}

{% macro logship(appshort, logfile, type='daemon', tags=['daemon','error'], format='json', delimiter='\\\\n', absent=False) -%}
{% if salt['pillar.get']('monitoring:enabled', True) and absent == false %}

{% set tags = ','.join(tags) %}

/etc/beaver.d/{{appshort}}.conf:
  file:
    - managed
    - source: salt://logstash/templates/beaver/beaver-file.conf
    - template: jinja
    - context:
      logfile: {{logfile}}
      format: {{format}}
      type: {{type}}
      tags: {{tags}}
      delimiter: "{{delimiter}}"
    - watch_in:
      - service: beaver
    - require:
      - file: /etc/beaver.d

{% endif %}

{% if absent == True %}
/etc/beaver.d/{{appshort}}.conf:
  file.absent
{% endif %}

{%- endmacro %}

Add absent flag on logship macro.
Add absent flag on logship macro.

If a logship line is removed, then the corresponding configuration file
is not removed from the disk. This flag makes sure that we do remove the
files.

ministryofjustice/logstash-formula,ministryofjustice/logstash-formula,ministryofjustice/logstash-formula,ministryofjustice/logstash-formula,ministryofjustice/logstash-formula