filebeat.inputs:
  - type: container
    paths:
      - '/var/lib/docker/containers/*/*.log'
  - type: log
    paths:
      - /opt/openvidu/kurento-logs/*.log
    fields:
      kurento-media-server: true
      ip: ${MEDIA_NODE_IP}
      cluster_id: ${CLUSTER_ID}
      node_id: ${NODE_ID}
      node_role: medianode
    fields_under_root: true

processors:
  - add_docker_metadata:
      host: "unix:///var/run/docker.sock"
  - add_host_metadata:
      netinfo.enabled: true

  - decode_json_fields:
      fields: ["message"]
      target: "json"
      overwrite_keys: true
  - drop_event:
      when.or:
        - contains:
            container.image.name: docker.elastic.co/beats/filebeat-oss
        - contains:
            container.image.name: docker.elastic.co/beats/metricbeat-oss

output:
  elasticsearch:
    indices:
      - index: "filebeat-kurento-%{+yyyy.MM.dd}"
        when.or:
          - equals:
              kurento-media-server: true
      - index: "filebeat-mediasoup-%{+yyyy.MM.dd}"
        when.or:
          - contains:
              container.image.name: openvidu/mediasoup-controller
      - index: "filebeat-media-node-controller-%{+yyyy.MM.dd}"
        when.or:
          - contains:
              container.image.name: openvidu/media-node-controller
      - index: "filebeat-openvidu-recording-%{+yyyy.MM.dd}"
        when.or:
          - contains:
              container.image.name: openvidu/openvidu-recording
    pipelines:
      - pipeline: kurento-pipeline
        when.or:
          - equals:
              kurento-media-server: true

logging.json: true
logging.metrics.enabled: false
setup.ilm.enabled: false
