{{ if eq .input "http_endpoint" }}

type: http_endpoint

listen_address: {{ .listen_address }}
listen_port: {{ .listen_port }}
prefix: json
content_type: application/x-ndjson

{{ if .secret }}
hmac:
  header: X-Filebeat-Signature
  key: {{ .secret }}
  type: sha256
  prefix: sha256=
{{ end }}

{{ if .ssl }}
ssl: {{ .ssl | tojson }}
{{ end }}

{{ if .preserve_original_event }}
preserve_original_event: true
{{ end }}

{{ else if eq .input "file" }}

type: log
paths:
{{ range $i, $path := .paths }}
  - {{$path}}
{{ end }}
exclude_files: [".gz$"]
json.add_error_key: true
{{ end }}

tags:
{{if .preserve_original_event}}
  - preserve_original_event
{{end}}
{{range $val := .tags}}
  - {{$val}}
{{end}}

publisher_pipeline.disable_host: {{ inList .tags "forwarded" }}

processors:
  - add_locale: ~
  - add_fields:
      target: ''
      fields:
        ecs.version: 1.12.0
