type: log
paths:
{{ range $i, $path := .paths }}
 - {{$path}}
{{ end }}
exclude_files: [".gz$"]
tags: {{.tags | tojson}}
publisher_pipeline.disable_host: {{ inList .tags "forwarded" }}

json.keys_under_root: false

fields_under_root: true
fields:
  network.transport: udp
  network.protocol: snmp

processors:
  - rename:
      fields:
        - from: "json"
          to: "zeek.snmp"

        - from: "zeek.snmp.id.orig_h"
          to: "source.address"

        - from: "zeek.snmp.id.orig_p"
          to: "source.port"

        - from: "zeek.snmp.id.resp_h"
          to: "destination.address"

        - from: "zeek.snmp.id.resp_p"
          to: "destination.port"

        - from: "zeek.snmp.uid"
          to: "event.id"

        - from: "zeek.snmp.get_requests"
          to: "zeek.snmp.get.requests"

        - from: "zeek.snmp.get_bulk_requests"
          to: "zeek.snmp.get.bulk_requests"

        - from: "zeek.snmp.get_responses"
          to: "zeek.snmp.get.responses"

        - from: "zeek.snmp.set_requests"
          to: "zeek.snmp.set.requests"

      ignore_missing: true
      fail_on_error: false
  - convert:
      fields:
        - {from: "zeek.session_id", to: "event.id"}
        - {from: "source.address", to: "source.ip", type: "ip"}
        - {from: "destination.address", to: "destination.ip", type: "ip"}
      ignore_missing: true
      fail_on_error: false
  - add_fields:
      target: event
      fields:
        kind: event
        category:
          - network
        type:
          - connection
          - protocol
  - community_id:
{{ if .internal_networks }}
  - add_network_direction:
      source: source.ip
      destination: destination.ip
      target: network.direction
      internal_networks: {{ .internal_networks | tojson }}
{{ end }}
  - add_fields:
      target: ''
      fields:
        ecs.version: 1.12.0
