- Metricbeat Reference: other versions:
- Metricbeat overview
- Quick start: installation and configuration
- Set up and run
- Upgrade Metricbeat
- How Metricbeat works
- Configure
- Modules
- General settings
- Project paths
- Config file loading
- Output
- Kerberos
- SSL
- Index lifecycle management (ILM)
- Elasticsearch index template
- Kibana endpoint
- Kibana dashboards
- Processors
- Define processors
- add_cloud_metadata
- add_cloudfoundry_metadata
- add_docker_metadata
- add_fields
- add_host_metadata
- add_id
- add_kubernetes_metadata
- add_labels
- add_locale
- add_network_direction
- add_nomad_metadata
- add_observer_metadata
- add_process_metadata
- add_tags
- append
- community_id
- convert
- copy_fields
- decode_base64_field
- decode_duration
- decode_json_fields
- decode_xml
- decode_xml_wineventlog
- decompress_gzip_field
- detect_mime_type
- dissect
- dns
- drop_event
- drop_fields
- extract_array
- fingerprint
- include_fields
- move_fields
- rate_limit
- registered_domain
- rename
- replace
- script
- syslog
- translate_ldap_attribute
- translate_sid
- truncate_fields
- urldecode
- Autodiscover
- Internal queue
- Logging
- HTTP endpoint
- Regular expression support
- Instrumentation
- Feature flags
- metricbeat.reference.yml
- How to guides
- Modules
- ActiveMQ module
- Aerospike module
- Airflow module
- Apache module
- AWS module
- AWS awshealth metricset
- AWS billing metricset
- AWS cloudwatch metricset
- AWS dynamodb metricset
- AWS ebs metricset
- AWS ec2 metricset
- AWS elb metricset
- AWS kinesis metricset
- AWS lambda metricset
- AWS natgateway metricset
- AWS rds metricset
- AWS s3_daily_storage metricset
- AWS s3_request metricset
- AWS sns metricset
- AWS sqs metricset
- AWS transitgateway metricset
- AWS usage metricset
- AWS vpn metricset
- AWS Fargate module
- Azure module
- Azure app_insights metricset
- Azure app_state metricset
- Azure billing metricset
- Azure compute_vm metricset
- Azure compute_vm_scaleset metricset
- Azure container_instance metricset
- Azure container_registry metricset
- Azure container_service metricset
- Azure database_account metricset
- Azure monitor metricset
- Azure storage metricset
- Beat module
- Ceph module
- Ceph cluster_disk metricset
- Ceph cluster_health metricset
- Ceph cluster_status metricset
- Ceph mgr_cluster_disk metricset
- Ceph mgr_cluster_health metricset
- Ceph mgr_osd_perf metricset
- Ceph mgr_osd_pool_stats metricset
- Ceph mgr_osd_tree metricset
- Ceph mgr_pool_disk metricset
- Ceph monitor_health metricset
- Ceph osd_df metricset
- Ceph osd_tree metricset
- Ceph pool_disk metricset
- Cloudfoundry module
- CockroachDB module
- Consul module
- Containerd module
- Coredns module
- Couchbase module
- CouchDB module
- Docker module
- Dropwizard module
- Elasticsearch module
- Elasticsearch ccr metricset
- Elasticsearch cluster_stats metricset
- Elasticsearch enrich metricset
- Elasticsearch index metricset
- Elasticsearch index_recovery metricset
- Elasticsearch index_summary metricset
- Elasticsearch ingest_pipeline metricset
- Elasticsearch ml_job metricset
- Elasticsearch node metricset
- Elasticsearch node_stats metricset
- Elasticsearch pending_tasks metricset
- Elasticsearch shard metricset
- Enterprise Search module
- Envoyproxy module
- Etcd module
- Google Cloud Platform module
- Google Cloud Platform billing metricset
- Google Cloud Platform carbon metricset
- Google Cloud Platform compute metricset
- Google Cloud Platform dataproc metricset
- Google Cloud Platform firestore metricset
- Google Cloud Platform gke metricset
- Google Cloud Platform loadbalancing metricset
- Google Cloud Platform metrics metricset
- Google Cloud Platform pubsub metricset
- Google Cloud Platform storage metricset
- Golang module
- Graphite module
- HAProxy module
- HTTP module
- IBM MQ module
- IIS module
- Istio module
- Jolokia module
- Kafka module
- Kibana module
- Kubernetes module
- Kubernetes apiserver metricset
- Kubernetes container metricset
- Kubernetes controllermanager metricset
- Kubernetes event metricset
- Kubernetes node metricset
- Kubernetes pod metricset
- Kubernetes proxy metricset
- Kubernetes scheduler metricset
- Kubernetes state_container metricset
- Kubernetes state_cronjob metricset
- Kubernetes state_daemonset metricset
- Kubernetes state_deployment metricset
- Kubernetes state_job metricset
- Kubernetes state_node metricset
- Kubernetes state_persistentvolumeclaim metricset
- Kubernetes state_pod metricset
- Kubernetes state_replicaset metricset
- Kubernetes state_resourcequota metricset
- Kubernetes state_service metricset
- Kubernetes state_statefulset metricset
- Kubernetes state_storageclass metricset
- Kubernetes system metricset
- Kubernetes volume metricset
- KVM module
- Linux module
- Logstash module
- Memcached module
- Cisco Meraki module
- MongoDB module
- MSSQL module
- Munin module
- MySQL module
- NATS module
- Nginx module
- Openmetrics module
- Oracle module
- Panw module
- PHP_FPM module
- PostgreSQL module
- Prometheus module
- RabbitMQ module
- Redis module
- Redis Enterprise module
- SQL module
- Stan module
- Statsd module
- SyncGateway module
- System module
- System core metricset
- System cpu metricset
- System diskio metricset
- System entropy metricset
- System filesystem metricset
- System fsstat metricset
- System load metricset
- System memory metricset
- System network metricset
- System network_summary metricset
- System process metricset
- System process_summary metricset
- System raid metricset
- System service metricset
- System socket metricset
- System socket_summary metricset
- System uptime metricset
- System users metricset
- Tomcat module
- Traefik module
- uWSGI module
- vSphere module
- Windows module
- ZooKeeper module
- Exported fields
- ActiveMQ fields
- Aerospike fields
- Airflow fields
- Apache fields
- AWS fields
- AWS Fargate fields
- Azure fields
- Beat fields
- Beat fields
- Ceph fields
- Cloud provider metadata fields
- Cloudfoundry fields
- CockroachDB fields
- Common fields
- Consul fields
- Containerd fields
- Coredns fields
- Couchbase fields
- CouchDB fields
- Docker fields
- Docker fields
- Dropwizard fields
- ECS fields
- Elasticsearch fields
- Enterprise Search fields
- Envoyproxy fields
- Etcd fields
- Google Cloud Platform fields
- Golang fields
- Graphite fields
- HAProxy fields
- Host fields
- HTTP fields
- IBM MQ fields
- IIS fields
- Istio fields
- Jolokia fields
- Jolokia Discovery autodiscover provider fields
- Kafka fields
- Kibana fields
- Kubernetes fields
- Kubernetes fields
- KVM fields
- Linux fields
- Logstash fields
- Memcached fields
- MongoDB fields
- MSSQL fields
- Munin fields
- MySQL fields
- NATS fields
- Nginx fields
- Openmetrics fields
- Oracle fields
- Panw fields
- PHP_FPM fields
- PostgreSQL fields
- Process fields
- Prometheus fields
- Prometheus typed metrics fields
- RabbitMQ fields
- Redis fields
- Redis Enterprise fields
- SQL fields
- Stan fields
- Statsd fields
- SyncGateway fields
- System fields
- Tomcat fields
- Traefik fields
- uWSGI fields
- vSphere fields
- Windows fields
- ZooKeeper fields
- Monitor
- Secure
- Troubleshoot
- Get help
- Debug
- Understand logged metrics
- Common problems
- "open /compat/linux/proc: no such file or directory" error on FreeBSD
- Metricbeat collects system metrics for interfaces you didn’t configure
- Metricbeat uses too much bandwidth
- Error loading config file
- Found unexpected or unknown characters
- Logstash connection doesn’t work
- Publishing to Logstash fails with "connection reset by peer" message
- @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
- Dashboard could not locate the index-pattern
- High RSS memory usage due to MADV settings
- Contribute to Beats
Configure logging
editConfigure logging
editThe logging
section of the metricbeat.yml
config file contains options
for configuring the logging output.
The logging system can write logs to the syslog or rotate log files. If logging
is not explicitly configured the file output is used.
logging.level: info logging.to_files: true logging.files: path: /var/log/metricbeat name: metricbeat keepfiles: 7 permissions: 0640
In addition to setting logging options in the config file, you can modify the logging output configuration from the command line. See Command reference.
When Metricbeat is running on a Linux system with systemd, it uses
by default the -e
command line option, that makes it write all the logging output
to stderr so it can be captured by journald. Other outputs are disabled. See
Metricbeat and systemd to know more and learn how to change this.
Configuration options
editYou can specify the following options in the logging
section of the
metricbeat.yml
config file:
logging.to_stderr
editWhen true, writes all logging output to standard error output. This is
equivalent to using the -e
command line option.
logging.to_syslog
editWhen true, writes all logging output to the syslog.
This option is not supported on Windows.
logging.to_eventlog
editWhen true, writes all logging output to the Windows Event Log.
logging.to_files
editWhen true, writes all logging output to files. The log files are automatically rotated when the log file size limit is reached.
Metricbeat only creates a log file if there is logging output. For
example, if you set the log level
to error
and there are no
errors, there will be no log file in the directory specified for logs.
logging.level
editMinimum log level. One of debug
, info
, warning
, or error
. The default
log level is info
.
-
debug
-
Logs debug messages, including a detailed printout of all events
flushed. Also logs informational messages, warnings, errors, and
critical errors. When the log level is
debug
, you can specify a list ofselectors
to display debug messages for specific components. If no selectors are specified, the*
selector is used to display debug messages for all components. -
info
- Logs informational messages, including the number of events that are published. Also logs any warnings, errors, or critical errors.
-
warning
- Logs warnings, errors, and critical errors.
-
error
- Logs errors and critical errors.
logging.selectors
editThe list of debugging-only selector tags used by different Metricbeat components.
Use *
to enable debug output for all components. Use publisher
to display
debug messages related to event publishing.
The list of available selectors may change between releases, so avoid creating tests that depend on specific selectors.
To see which selectors are available, run Metricbeat in debug mode
(set logging.level: debug
in the configuration). The selector name appears
after the log level and is enclosed in brackets.
To configure multiple selectors, use the following YAML list syntax:
logging.selectors: [ harvester, input ]
To override selectors at the command line, use the -d
global flag (-d
also
sets the debug log level). For more information, see Command reference.
logging.metrics.enabled
editBy default, Metricbeat periodically logs its internal metrics that have changed in the last period. For each metric that changed, the delta from the value at the beginning of the period is logged. Also, the total values for all non-zero internal metrics are logged on shutdown. Set this to false to disable this behavior. The default is true.
Here is an example log line:
2017-12-17T19:17:42.667-0500 INFO [metrics] log/log.go:110 Non-zero metrics in the last 30s: beat.info.uptime.ms=30004 beat.memstats.gc_next=5046416
Note that we currently offer no backwards compatible guarantees for the internal metrics and for this reason they are also not documented.
logging.metrics.period
editThe period after which to log the internal metrics. The default is 30s.
logging.metrics.namespaces
editA list of metrics namespaces to report in the logs. Defaults to [stats]
.
stats
contains general Beat metrics. dataset
and inputs
may be present in
some Beats and contains module or input metrics.
logging.files.path
editThe directory that log files are written to. The default is the logs path. See the Directory layout section for details.
logging.files.name
editThe name of the file that logs are written to. The default is metricbeat.
logging.files.rotateeverybytes
editThe maximum size of a log file. If the limit is reached, a new log file is generated. The default size limit is 10485760 (10 MB).
logging.files.keepfiles
editThe number of most recent rotated log files to keep on disk. Older files are
deleted during log rotation. The default value is 7. The keepfiles
options has
to be in the range of 2 to 1024 files.
logging.files.permissions
editThe permissions mask to apply when rotating log files. The default value is
0600. The permissions
option must be a valid Unix-style file permissions mask
expressed in octal notation. In Go, numbers in octal notation must start with
0.
The most permissive mask allowed is 0640. If a higher permissions mask is specified via this setting, it will be subject to an umask of 0027.
This option is not supported on Windows.
Examples:
- 0640: give read and write access to the file owner, and read access to members of the group associated with the file.
- 0600: give read and write access to the file owner, and no access to all others.
logging.files.interval
editEnable log file rotation on time intervals in addition to size-based rotation. Intervals must be at least 1s. Values of 1m, 1h, 24h, 7*24h, 30*24h, and 365*24h are boundary-aligned with minutes, hours, days, weeks, months, and years as reported by the local system clock. All other intervals are calculated from the unix epoch. Defaults to disabled.
logging.files.rotateonstartup
editIf the log file already exists on startup, immediately rotate it and start writing to a new file instead of appending to the existing one. Defaults to true.
logging.files.redirect_stderr
[preview]
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
editWhen true, diagnostic messages printed to Metricbeat’s standard error output
will also be logged to the log file. This can be helpful in situations were
Metricbeat terminates unexpectedly because an error has been detected by
Go’s runtime but diagnostic information is not present in the log file.
This feature is only available when logging to files (logging.to_files
is true).
Disabled by default.
Logging format
editThe logging format is generally the same for each logging output. The one exception is with the syslog output where the timestamp is not included in the message because syslog adds its own timestamp.
Each log message consists of the following parts:
- Timestamp in ISO8601 format
- Level
- Logger name contained in brackets (Optional)
- File name and line number of the caller
- Message
- Structured data encoded in JSON (Optional)
Below are some samples:
2017-12-17T18:54:16.241-0500 INFO logp/core_test.go:13 unnamed global logger
2017-12-17T18:54:16.242-0500 INFO [example] logp/core_test.go:16 some message
2017-12-17T18:54:16.242-0500 INFO [example] logp/core_test.go:19 some message {"x": 1}
Configuration options for event_data logger
editSome outputs will log raw events on errors like indexing errors in the Elasticsearch output, to prevent logging raw events (that may contain sensitive information) together with other log messages, a different log file, only for log entries containing raw events, is used. It will use the same level, selectors and all other configurations from the default logger, but it will have it’s own file configuration.
Having a different log file for raw events also prevents event data from drowning out the regular log files.
No matter the default logger output configuration, raw events
will always be logged to a file configured by logging.event_data.files
.
logging.event_data.files.path
editThe directory that log files are written to. The default is the logs path. See the Directory layout section for details.
logging.event_data.files.name
editThe name of the file that logs are written to. The default is metricbeat-events-data.
logging.event_data.files.rotateeverybytes
editThe maximum size of a log file. If the limit is reached, a new log file is generated. The default size limit is 5242880 (5 MB).
logging.event_data.files.keepfiles
editThe number of most recent rotated log files to keep on disk. Older files are
deleted during log rotation. The default value is 2. The keepfiles
options has
to be in the range of 2 to 1024 files.
logging.event_data.files.permissions
editThe permissions mask to apply when rotating log files. The default value is
0600. The permissions
option must be a valid Unix-style file permissions mask
expressed in octal notation. In Go, numbers in octal notation must start with
0.
The most permissive mask allowed is 0640. If a higher permissions mask is specified via this setting, it will be subject to an umask of 0027.
This option is not supported on Windows.
Examples:
- 0640: give read and write access to the file owner, and read access to members of the group associated with the file.
- 0600: give read and write access to the file owner, and no access to all others.
logging.event_data.files.interval
editEnable log file rotation on time intervals in addition to size-based rotation. Intervals must be at least 1s. Values of 1m, 1h, 24h, 7*24h, 30*24h, and 365*24h are boundary-aligned with minutes, hours, days, weeks, months, and years as reported by the local system clock. All other intervals are calculated from the unix epoch. Defaults to disabled.
logging.event_data.files.rotateonstartup
editIf the log file already exists on startup, immediately rotate it and start writing to a new file instead of appending to the existing one. Defaults to false.
On this page
- Configuration options
logging.to_stderr
logging.to_syslog
logging.to_eventlog
logging.to_files
logging.level
logging.selectors
logging.metrics.enabled
logging.metrics.period
logging.metrics.namespaces
logging.files.path
logging.files.name
logging.files.rotateeverybytes
logging.files.keepfiles
logging.files.permissions
logging.files.interval
logging.files.rotateonstartup
logging.files.redirect_stderr
[preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.- Logging format
- Configuration options for event_data logger
logging.event_data.files.path
logging.event_data.files.name
logging.event_data.files.rotateeverybytes
logging.event_data.files.keepfiles
logging.event_data.files.permissions
logging.event_data.files.interval
logging.event_data.files.rotateonstartup
ElasticON events are back!
Learn about the Elastic Search AI Platform from the experts at our live events.
Register now