- Filebeat Reference: other versions:
- Overview
- Getting Started With Filebeat
- Setting up and running Filebeat
- Upgrading Filebeat
- How Filebeat works
- Configuring Filebeat
- Specify which modules to run
- Configure inputs
- Manage multiline messages
- Specify general settings
- Load external configuration files
- Configure the internal queue
- Configure the output
- Configure index lifecycle management
- Load balance the output hosts
- Specify SSL settings
- Filter and enhance the exported data
- Define processors
- Add cloud metadata
- Add fields
- Add labels
- Add the local time zone
- Add tags
- Decode CEF
- Decode CSV fields
- Decode JSON fields
- Decode Base64 fields
- Decompress gzip fields
- Community ID Network Flow Hash
- Convert
- Drop events
- Drop fields from events
- Extract array
- Keep fields from events
- Registered Domain
- Rename fields from events
- Add Kubernetes metadata
- Add Docker metadata
- Add Host metadata
- Add Observer metadata
- Dissect strings
- DNS Reverse Lookup
- Add process metadata
- Script Processor
- Timestamp
- Parse data by using ingest node
- Enrich events with geoIP information
- Configure project paths
- Configure the Kibana endpoint
- Load the Kibana dashboards
- Load the Elasticsearch index template
- Configure logging
- Use environment variables in the configuration
- Autodiscover
- YAML tips and gotchas
- Regular expression support
- HTTP Endpoint
- filebeat.reference.yml
- Beats central management
- Modules
- Modules overview
- Apache module
- Auditd module
- AWS module
- CEF module
- Cisco module
- Coredns Module
- Elasticsearch module
- Envoyproxy Module
- Google Cloud module
- haproxy module
- IBM MQ module
- Icinga module
- IIS module
- Iptables module
- Kafka module
- Kibana module
- Logstash module
- MongoDB module
- MSSQL module
- MySQL module
- nats module
- NetFlow module
- Nginx module
- Osquery module
- Palo Alto Networks module
- PostgreSQL module
- RabbitMQ module
- Redis module
- Santa module
- Suricata module
- System module
- Traefik module
- Zeek (Bro) Module
- Exported fields
- Apache fields
- Auditd fields
- AWS fields
- Beat fields
- Decode CEF processor fields fields
- CEF fields
- Cisco fields
- Cloud provider metadata fields
- Coredns fields
- Docker fields
- ECS fields
- elasticsearch fields
- Envoyproxy fields
- Google Cloud fields
- haproxy fields
- Host fields
- ibmmq fields
- Icinga fields
- IIS fields
- iptables fields
- Jolokia Discovery autodiscover provider fields
- Kafka fields
- kibana fields
- Kubernetes fields
- Log file content fields
- logstash fields
- mongodb fields
- mssql fields
- MySQL fields
- nats fields
- NetFlow fields
- NetFlow fields
- Nginx fields
- Osquery fields
- panw fields
- PostgreSQL fields
- Process fields
- RabbitMQ fields
- Redis fields
- s3 fields
- Google Santa fields
- Suricata fields
- System fields
- Traefik fields
- Zeek fields
- Monitoring Filebeat
- Securing Filebeat
- Troubleshooting
- Get help
- Debug
- Common problems
- Can’t read log files from network volumes
- Filebeat isn’t collecting lines from a file
- Too many open file handlers
- Registry file is too large
- Inode reuse causes Filebeat to skip lines
- Log rotation results in lost or duplicate events
- Open file handlers cause issues with Windows file rotation
- Filebeat is using too much CPU
- Dashboard in Kibana is breaking up data fields incorrectly
- Fields are not indexed or usable in Kibana visualizations
- Filebeat isn’t shipping the last line of a file
- Filebeat keeps open file handlers of deleted files for a long time
- Filebeat uses too much bandwidth
- Error loading config file
- Found unexpected or unknown characters
- Logstash connection doesn’t work
- @metadata is missing in Logstash
- Not sure whether to use Logstash or Beats
- SSL client fails to connect to Logstash
- Monitoring UI shows fewer Beats than expected
- Contributing to Beats
Hints based autodiscover
editHints based autodiscover
editFilebeat supports autodiscover based on hints from the provider. The hints system looks for
hints in Kubernetes Pod annotations or Docker labels that have the prefix co.elastic.logs
. As soon as
the container starts, Filebeat will check if it contains any hints and launch the proper config for
it. Hints tell Filebeat how to get logs for the given container. By default logs will be retrieved
from the container using the container
input. You can use hints to modify this behavior. This is the full
list of supported hints:
co.elastic.logs/enabled
editFilebeat gets logs from all containers by default, you can set this hint to false
to ignore
the output of the container. Filebeat won’t read or send logs from it. If default config is
disabled, you can use this annotation to enable log retrieval only for containers with this
set to true
.
co.elastic.logs/multiline.*
editMultiline settings. See Manage multiline messages for a full list of all supported options.
co.elastic.logs/include_lines
editA list of regular expressions to match the lines that you want Filebeat to include. See Configure inputs for more info.
co.elastic.logs/exclude_lines
editA list of regular expressions to match the lines that you want Filebeat to exclude. See Configure inputs for more info.
co.elastic.logs/module
editInstead of using raw docker
input, specifies the module to use to parse logs from the container. See
Modules for the list of supported modules.
co.elastic.logs/fileset
editWhen module is configured, map container logs to module filesets. You can either configure a single fileset like this:
co.elastic.logs/fileset: access
Or configure a fileset per stream in the container (stdout and stderr):
co.elastic.logs/fileset.stdout: access co.elastic.logs/fileset.stderr: error
co.elastic.logs/raw
editWhen an entire input/module configuration needs to be completely set the raw
hint can be used. You can provide a
stringified JSON of the input configuration. raw
overrides every other hint and can be used to create both a single or
a list of configurations.
co.elastic.logs/raw: "[{\"containers\":{\"ids\":[\"${data.container.id}\"]},\"multiline\":{\"negate\":\"true\",\"pattern\":\"^test\"},\"type\":\"docker\"}]"
co.elastic.logs/processors
editDefine a processor to be added to the Filebeat input/module configuration. See Filter and enhance the exported data for the list of supported processors.
In order to provide ordering of the processor definition, numbers can be provided. If not, the hints builder will do arbitrary ordering:
co.elastic.logs/processors.1.dissect.tokenizer: "%{key1} %{key2}" co.elastic.logs/processors.dissect.tokenizer: "%{key2} %{key1}"
In the above sample the processor definition tagged with 1
would be executed first.
Kubernetes
editKubernetes autodiscover provider supports hints in Pod annotations. To enable it just set hints.enabled
:
filebeat.autodiscover: providers: - type: kubernetes hints.enabled: true
You can configure the default config that will be launched when a new container is seen, like this:
filebeat.autodiscover: providers: - type: kubernetes hints.enabled: true hints.default_config: type: container paths: - /var/log/container/*-${container.id}.log # CRI path
You can also disable default settings entirely, so only Pods annotated like co.elastic.logs/enabled: true
will be retrieved:
filebeat.autodiscover: providers: - type: kubernetes hints.enabled: true hints.default_config.enabled: false
You can annotate Kubernetes Pods with useful info to spin up Filebeat inputs or modules:
annotations: co.elastic.logs/multiline.pattern: '^\[' co.elastic.logs/multiline.negate: true co.elastic.logs/multiline.match: after
Multiple containers
editWhen a pod has multiple containers, the settings are shared unless you put the container name in the
hint. For example, these hints configure multiline settings for all containers in the pod, but set a
specific exclude_lines
hint for the container called sidecar
.
annotations: co.elastic.logs/multiline.pattern: '^\[' co.elastic.logs/multiline.negate: true co.elastic.logs/multiline.match: after co.elastic.logs.sidecar/exclude_lines: '^DBG'
Docker
editDocker autodiscover provider supports hints in labels. To enable it just set hints.enabled
:
filebeat.autodiscover: providers: - type: docker hints.enabled: true
You can configure the default config that will be launched when a new container is seen, like this:
filebeat.autodiscover: providers: - type: docker hints.enabled: true hints.default_config: type: container paths: - /var/log/container/*-${container.id}.log # CRI path
You can also disable default settings entirely, so only containers labeled with co.elastic.logs/enabled: true
will be retrieved:
filebeat.autodiscover: providers: - type: docker hints.enabled: true hints.default_config.enabled: false
You can label Docker containers with useful info to spin up Filebeat inputs, for example:
co.elastic.logs/module: nginx co.elastic.logs/fileset.stdout: access co.elastic.logs/fileset.stderr: error
The above labels configure Filebeat to use the Nginx module to harvest logs for this container. Access logs will be retrieved from stdout stream, and error logs from stderr.
On this page