#=========================== Filebeat prospectors=============================
filebeat.prospectors:
#指定文件的输入类型log(默认)或者stdin。
- input_type: log
# paths指定要监控的日志
paths:
- /var/log/*.log
#指定被监控的文件的编码类型使用plain和utf-8都是可以处理中文日志的。
# Some sample encodings:
# plain, utf-8, utf-16be-bom, utf-16be, utf-16le, big5, gb18030, gbk,
# hz-gb-2312, euc-kr, euc-jp, iso-2022-jp, shift-jis, ...
#encoding: plain
# 在输入中排除符合正则表达式列表的那些行
# exclude_lines: ["^DBG"]
# 包含输入中符合正则表达式列表的那些行默认包含所有行include_lines执行完毕之后会执行exclude_lines。
# include_lines: ["^ERR","^WARN"]
# 忽略掉符合正则表达式列表的文件默认为每一个符合paths定义的文件都创建一个harvester。
# exclude_files: [".gz$"]
# 向输出的每一条日志添加额外的信息比如“level:debug”方便后续对日志进行分组统计。默认情况下会在输出信息的fields子目录下以指定的新增fields建立子目录例如fields.level。
#fields:
# level: debug
# review: 1
# 如果该选项设置为true则新增fields成为顶级目录而不是将其放在fields目录下。自定义的field会覆盖filebeat默认的field。
#fields_under_root: false
# 可以指定Filebeat忽略指定时间段以外修改的日志内容比如2h两个小时或者5m(5分钟)。
#ignore_older: 0
# i设定Elasticsearch输出时的document的type字段也可以用来给日志进行分类。Default: log
#document_type: log
# Filebeat以多快的频率去prospector指定的目录下面检测文件更新比如是否有新增文件如果设置为0s则Filebeat会尽可能快地感知更新占用的CPU会变高。默认是10s。
#scan_frequency: 10s
# 每个harvester监控文件时使用的buffer的大小。
#harvester_buffer_size: 16384
# 日志文件中增加一行算一个日志事件max_bytes限制在一次日志事件中最多上传的字节数多出的字节会被丢弃。The default is 10MB.
#max_bytes: 10485760
# 适用于日志中每一条日志占据多行的情况比如各种语言的报错信息调用栈。这个配置的下面包含如下配置
# The regexp Pattern that has to bematched. The example pattern matches all lines starting with [
# multiline.pattern: ^\[
# Defines if the pattern set underpattern should be negated or not. Default is false.
# multiline.negate: false
# Match can be set to "after"or "before". It is used to define if lines should be append to apattern
# that was (not) matched before orafter or as long as a pattern is not matched based on negate.
# Note: After is the equivalent toprevious and before is the equivalent to to next in Logstash
# multiline.match: after
#The maximum number of lines that are combined to one event.
# In case there are more the max_linesthe additional lines are discarded.
# Default is 500
# multiline.max_lines: 500
# After the defined timeout, an multilineevent is sent even if no new pattern was found to start a new event
# Default is 5s.
# multiline.timeout: 5s
# 如果设置为trueFilebeat从文件尾开始监控文件新增内容把新增的每一行文件作为一个事件依次发送而不是从文件开始处重新发送所有内容。
#tail_files: false
# Experimental: If symlinks is enabled,symlinks are opened and harvested. The harvester is openening the
# original for harvesting but will reportthe symlink name as source.
#symlinks: false
# Filebeat检测到某个文件到了EOF之后每次等待多久再去检测文件是否有更新默认为1s。
#backoff: 1s
# Filebeat检测到某个文件到了EOF之后等待检测文件更新的最大时间默认是10秒。
#max_backoff: 10s
# 定义到达max_backoff的速度默认因子是2到达max_backoff后变成每次等待max_backoff那么长的时间才backoff一次直到文件有更新才会重置为backoff。
#backoff_factor: 2
# Experimental: Max number of harvestersthat are started in parallel.
# Default is 0 which means unlimited
#harvester_limit: 0
#----------------------------- Stdin prospector-------------------------------
# Configuration to use stdin input
#- input_type: stdin
#========================= Filebeat global options============================
# spooler的大小spooler中的事件数量超过这个阈值的时候会清空发送出去不论是否到达超时时间。
# filebeat.spool_size: 2048
# 是否采用异步发送模式(实验!)
# filebeat.publish_async: false
# spooler的超时时间如果到了超时时间spooler也会清空发送出去不论是否到达容量的阈值。
# filebeat.idle_timeout: 5s
# 记录filebeat处理日志文件的位置的文件
# datapath.
# filebeat.registry_file: ${path.data}/registry
# 如果要在本配置文件中引入其他位置的配置文件可以写在这里需要写完整路径但是只处理prospector的部分。
# filebeat.config_dir:
# filebeat等待多长时间后publisher关闭,默认0不等待
# filebeat.shutdown_timeout: 0
#================================ General======================================
# 用于发布网络数据的shipper名称. 可以被应用于组
# 所有的事务通过一个shipper发送到web接口
# 默认使用主机名.
#name:
# shipper的标记包含在自己的field中发表事物,通过不同的tags很容易给服务器逻辑分组
#tags: ["service-X","web-tier"]
# 可选字段,您可以指定额外的信息添加到输出。字段可以是标量值,数组,字典,或任何的嵌套组合
#fields:
# env: staging
# 如果将此选项设置为true,自定义字段作为顶级字段存储在输出文档,而不是sub-dictionary分组在一个字段。默认是false。
#fields_under_root: false
# 针对单一事件处理管道内部队列大小
#queue_size: 1000
# 大部分的内部队列大小事件的处理管道。
# 不要修改这个值。
#bulk_queue_size: 0
# 设置最大数量的cpu可以同时执行。默认是逻辑系统中可用的cpu的数量。
#max_procs:
#================================ Processors===================================
# 处理器是用来减少字段导出的事件或提高外部元数据的事件。本节定义的列表应用处理器,一个接一个,第一个接收到最初
# event:
#
# event -> filter1 -> event1 ->filter2 ->event2 ...
#
# 支持的处理器drop_fields,drop_event, include_fields, and add_cloud_metadata.
#
# 例如,您可以使用以下处理器保持字段包含CPU负载百分比,但是删除字段包含CPU属性
# values:
#
#processors:
#- include_fields:
# fields: ["cpu"]
#- drop_fields:
# fields: ["cpu.user","cpu.system"]
#
# The following example drops theevents that have the HTTP response code 200:
#
#processors:
#- drop_event:
# when:
# equals:
# http.code: 200
#
# 下面的示例丰富每个事件的云提供商关于主机的元数据。它可以在EC2,GCE,DigitalOcean上运行。
#
#processors:
#- add_cloud_metadata:
#
############################# Output##########################################
# 输出到数据配置.单个实例数据可以输出到elasticsearch或者logstash选择其中一种注释掉另外一组输出配置。
### 输出数据到Elasticsearch
output.elasticsearch:
# IPv6 addresses should always be definedas: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]
# Set gzip compression level.
#compression_level: 0
# 输出认证.
#protocol: "https"
#username: "elastic"
#password: "changeme"
#字典中的HTTP参数通过url索引操作。
#parameters:
#param1: value1
#param2: value2
# 启动进程数.
#worker: 1
# 输出数据到指定index defaultis "filebeat" 可以使用变量[filebeat-]YYYY.MM.DDkeys.
#index: "filebeat-%{+yyyy.MM.dd}"
# 一个模板用于设置在Elasticsearch映射默认模板加载是禁用的,没有加载模板这些设置可以调整或者覆盖现有的加载自己的模板
# Set to false to disable template loading.
#template.enabled: true
# Template name. By default the templatename is filebeat.
#template.name: "filebeat"
# Path to template file
#template.path:"${path.config}/filebeat.template.json"
# Overwrite existing template
#template.overwrite: false
# If set to true, filebeat checks theElasticsearch version at connect time, and if it
# is 2.x, it loads the file specified bythe template.versions.2x.path setting. The
# default is true.
#template.versions.2x.enabled: true
# Path to the Elasticsearch 2.x version ofthe template file.
#template.versions.2x.path:"${path.config}/filebeat.template-es2x.json"
# 发送重试的次数取决于max_retries的设置默认为3
#max_retries: 3
# 单个elasticsearch批量API索引请求的最大事件数。默认是50。
#bulk_max_size: 50
# elasticsearch请求超时事件。默认90秒.
#timeout: 90
# 新事件两个批量API索引请求之间需要等待的秒数。如果bulk_max_size在该值之前到达额外的批量索引请求生效。
#flush_interval: 1
# 使用https的SSL配置。默认true。
#Use SSL settings for HTTPS. Default is true.
#ssl.enabled: true
# Configure SSL verification mode. If`none` is configured, all server hosts
# and certificates will be accepted. In thismode, SSL based connections are
# susceptible to man-in-the-middle attacks.Use only for testing. Default is
# `full`.
#ssl.verification_mode: full
# List of supported/valid TLS versions. Bydefault all TLS versions 1.0 up to
# 1.2 are enabled.
#ssl.supported_protocols: [TLSv1.0,TLSv1.1, TLSv1.2]
# SSL configuration. By default is off.
# List of root certificates for HTTPSserver verifications
#ssl.certificate_authorities:["/etc/pki/root/ca.pem"]
# Certificate for SSL client authentication
#ssl.certificate:"/etc/pki/client/cert.pem"
# Client Certificate Key
#ssl.key:"/etc/pki/client/cert.key"
# Optional passphrase for decrypting theCertificate Key.
#ssl.key_passphrase: ''
# Configure cipher suites to beused for SSL connections
#ssl.cipher_suites: []
# Configure curve types for ECDHE basedcipher suites
#ssl.curve_types: []
#-----------------------------Logstash output ---------------------------------
### 发送数据到logstash单个实例数据可以输出到elasticsearch或者logstash选择其中一种注释掉另外一组输出配置。
# output.logstash:
# Logstash 主机地址
#hosts: ["localhost:5044"]
# 配置每个主机发布事件的worker数量。在负载均衡模式下最好启用。
#worker: 1
# #发送数据压缩级别
#compression_level: 3
# 如果设置为TRUE和配置了多台logstash主机输出插件将负载均衡的发布事件到所有logstash主机。
#如果设置为false输出插件发送所有事件到随机的一台主机上如果选择的不可达将切换到另一台主机。默认是false。
#loadbalance: true
# 输出数据到指定index defaultis "filebeat" 可以使用变量[filebeat-]YYYY.MM.DDkeys.
#index: filebeat
# Number of batches to be sendasynchronously to logstash while processing new batches.
#pipelining: 0
# SOCKS5 proxy server URL
#proxy_url: socks5://user:password@socks5-server:2233
# Resolve names locally when using a proxy server. Defaults to false.
#proxy_use_local_resolver: false
# Enable SSL support. SSL is automatically enabled, if any SSL settingis set.
#ssl.enabled: true
# Configure SSL verification mode. If `none` is configured, all serverhosts
# and certificates will be accepted. In this mode, SSL based connectionsare
# susceptible to man-in-the-middle attacks. Use only for testing.Default is
# `full`.
#ssl.verification_mode: full
# List of supported/valid TLS versions. By default all TLS versions 1.0up to
# 1.2 are enabled.
#ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2]
# Optional SSL configuration options. SSL is off by default.
# List of root certificates for HTTPS server verifications
#ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
# Certificate for SSL client authentication
#ssl.certificate: "/etc/pki/client/cert.pem"
# Client Certificate Key
#ssl.key: "/etc/pki/client/cert.key"
# Optional passphrase for decrypting the Certificate Key.
#ssl.key_passphrase: ''
# Configure cipher suites to be used for SSL connections
#ssl.cipher_suites: []
# Configure curve types for ECDHE based cipher suites
#ssl.curve_types: []
### Console output 标准输出JSON 格式。
# console:
#如果设置为TRUE事件将很友好的格式化标准输出。默认false。
#pretty: false
#------------------------------- File output-----------------------------------
#output.file:
# Boolean flag to enable ordisable the output module.
#enabled: true
# Path to the directorywhere to save the generated files. The option is
# mandatory.
#path:"/tmp/filebeat"
# Name of the generatedfiles. The default is `filebeat` and it generates
# files: `filebeat`,`filebeat.1`, `filebeat.2`, etc.
#filename: filebeat
# Maximum size in kilobytesof each file. When this size is reached, and on
# every filebeat restart,the files are rotated. The default value is 10240
# kB.
#rotate_every_kb: 10000
# Maximum number of filesunder path. When this number of files is reached,
# the oldest file is deletedand the rest are shifted from last to first. The
# default is 7 files.
#number_of_files: 7
############################# Logging#########################################
# 配置beats日志。日志可以写入到syslog也可以是轮滚日志文件。默认是syslog。
# 设置日志级别,默认是info,可选:critical, error, warning, info, debug
#logging.level:info
# 为所选组件启用调试输出. 默认["*"]
# 其它可选selectors: "beat", "publish", "service"
#Multiple selectors can be chained.
#logging.selectors:[ ]
# 如果启用发送所有日志到系统日志。
# logging. to_syslog: true
# 如果启用,filebeat定期记录其内部指标,改变了过去。对于每个指标改变,δ值的记录的开始时期。同时,所有内部指标非零总值登录关闭。默认是true。
#logging.metrics.enabled:true
# 记录内部指标的周期。The default is 30s.
#logging.metrics.period:30s
# 日志发送到轮滚文件。
logging.to_files: true
logging.files:
# 日志文件目录。
#path: /var/log/filebeat
# 日志文件名称
#name: filebeat
# 日志文件的最大大小。默认 10485760(10 MB)。
rotateeverybytes: 10485760 # = 10MB
# 保留日志周期。 默认 7。值范围为2 到 1024。
#keepfiles: 7