# Filebeat configuration: output → Elasticsearch
# Generated by RDT (Rambo Docker Tools)
# Service: {{ service_name }}
# Mode: output-elasticsearch
{% set es_host = filebeat_es_host | default(smart_env.FILEBEAT_ES_HOST) | default('elasticsearch:9200') %}
{% set kibana_host = filebeat_kibana_host | default(smart_env.FILEBEAT_KIBANA_HOST) | default('') %}

filebeat.inputs:
  - type: filestream
    id: default-filestream
    enabled: true
    paths:
      - {{ filebeat_log_path | default('/var/log/*.log') }}
    # Add more paths or inputs as needed

{% if kibana_host %}
setup.kibana:
  host: "{{ kibana_host }}"

{% endif %}
output.elasticsearch:
  hosts: ["http://{{ es_host }}"]
{% if filebeat_es_user is defined and filebeat_es_user %}
  username: "{{ filebeat_es_user }}"
  password: "{{ filebeat_es_password | default('') }}"
{% endif %}

processors:
  - add_host_metadata: ~
  - add_cloud_metadata: ~

# Logging
logging.level: info
logging.to_files: true
logging.files:
  path: /usr/share/filebeat/logs
  name: filebeat
  keepfiles: 7
  permissions: 0644

