美文网首页
filebeat_OutPut 介绍

filebeat_OutPut 介绍

作者: bdslinux | 来源:发表于2017-06-11 11:30 被阅读3213次

title: filebeat Output

date: 2017-06-11 05:22:31

categories: elk

tags: filebeat


Filbeat OutPut

Filebeat Elasticsearch OutPut

configure

output.elasticsearch:
  hosts: ["http://localhost:9200"]
  template.enabled: true
  template.path: "filebeat.template.json"
  template.overwrite: false
  index: "filebeat"
  ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
  ssl.certificate: "/etc/pki/client/cert.pem"
  ssl.key: "/etc/pki/client/cert.key"

定义ip port add portocalhttps

output.elasticsearch:
  hosts: ["localhost"]
  protocol: "https"
  username: "admin"
  password: "s3cr3t"

  • compression_level

    • gzip 压缩级别 range(1-9)
  • work

    • 发送事件到es的工作数量
  • index

    • The index name to write events to.
    • The default is "filebeat-%{+yyyy.MM.dd}" (for example,"filebeat-2015.04.26").
  • indices

支持条件,基于格式字符串的字段访问和名称映射的索引选择器规则的数组

- index 
    - 要使用的索引格式字符串。 如果使用的字段丢失,则规则失败。 
- mapping 
    - 映射字典为新名字
- default 
    - 默认字符串数值
- when  
    - 选择匹配条件

```
output.elasticsearch:
  hosts: ["http://localhost:9200"]
  index: "logs-%{+yyyy.MM.dd}"
  indices:
    - index: "critical-%{+yyyy.MM.dd}"
      when.contains:
        message: "CRITICAL"
    - index: "error-%{+yyyy.MM.dd}"
      when.contains:
        message: "ERR"

```
  • pipeline

    • 格式字符串指定获取节点写入事件pipeline的id值

        output.elasticsearch:
          hosts: ["http://localhost:9200"]
          pipeline: my_pipeline_id
      
  • pipelines

    filebeat.prospectors:
    - paths: ["/var/log/app/normal/*.log"]
        fields:
        type: "normal"
    - paths: ["/var/log/app/critical/*.log"]
        fields:
        type: "critical"
    
    output.elasticsearch:
    hosts: ["http://localhost:9200"]
    index: "filebeat-%{+yyyy.MM.dd}"
    pipelines:
      - pipeline: critical_pipeline
           when.equals:
              type: "critical"
     - pipeline: normal_pipeline
           when.equals:
              type: "normal"
    
    
  • template

    output.elasticsearch:
      hosts: ["localhost:9200"]
      template.name: "filebeat"
      template.path: "filebeat.template.json"
      template.overwrite: false
  • templates.versions
output.elasticsearch:
  hosts: ["localhost:9200"]
  template.path: "filebeat.template.json"
  template.overwrite: false
  template.versions.2x.path: "filebeat.template-es2x.json

  • max_retries

    • 当发送失败的时候,尝试多少次发送事件
  • bulk_max_size

    • 单个Elasticsearch批量API索引请求中批量的最大事件数 默认值为50
  • timeout

    • The http request timeout in seconds for the Elasticsearch request
    • The default is 90
  • flush_interval

    • 在两个批量API索引请求之间等待新事件的秒数
  • ssl

Filebeat Logstash OutPut

需要logstash服务端安装beat插件 使用lumberjack协议发送事件到logstash

output.logstash:
  hosts: ["localhost:5044"]

  • Metadata Fields
    • @meatedata
      • Filebeat使用@metadata字段将元数据发送到Logstash

      • @metadata字段的内容只存在于Logstash中,不属于从Logstash发送的任何事件的一部分

      • 有关@metadata字段的更多信息,请参阅Logstash文档logstash doucument

          {
              ...
              "@metadata": { 
                "beat": "filebeat", 
                "type": "<event type>" 
              }   
          }
        

logstash to elasticsearch

input {
  beats {
    port => 5044
  }
}

output {
  elasticsearch {
    hosts => ["http://localhost:9200"]
    index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}" 
    document_type => "%{[@metadata][type]}" 
  }
}

  • enabled

  • hosts

  • compression_level

  • worker

  • loadbalance

    output.logstash:
      hosts: ["localhost:5044", "localhost:5045"]
      loadbalance: true
      index: filebeat
    
  • pipelining

    • 异步处理事件,默认关闭
  • index

  • ssl

  • timeout

  • max_retries

  • bulk_max_size

    • The maximum number of events to bulk in a single Logstash request
    • The default is 2048.

kafka OutPut

The Kafka output sends the events to Apache Kafka.

output.kafka:
  # initial brokers for reading cluster metadata
  hosts: ["kafka1:9092", "kafka2:9092", "kafka3:9092"]

  # message topic selection + partitioning
  topic: '%{[type]}'
  partition.round_robin:
    reachable_only: false

  required_acks: 1
  compression: gzip
  max_message_bytes: 1000000

  • enabled

  • hosts

  • version

  • username

  • password

  • topic

  • topics

    • topic
    • mapping
    • default
    • when
  • partition

    • random.group_events
    • round_robin.group_events
    • hash.hash
    • hash.random
  • client_id

  • worker

  • codec

  • metadata

    • refresh_frequency
    • retry.max
    • retry.backoff
  • max_retries

  • bulk_max_size

  • timeout

  • broker_timeout

  • channel_buffer_size

  • keep_alive

  • compression

  • max_message_bytes

  • required_acks

  • flush_interval

  • ssl

Redis OutPut

This output works with Redis 3.2.4.

output.redis:
  hosts: ["localhost"]
  password: "my_password"
  key: "filebeat"
  db: 0
  timeout: 5

  • enabled
  • hosts
  • port
  • index
  • key
    output.redis:
      hosts: ["localhost"]
      key: "%{[fields.list]:fallback}"  
  • keys

    • key

    • mapping

    • default

    • when

        output.redis:
          hosts: ["localhost"]
          key: "default_list"
          keys:
            - key: "info_list"   # send to info_list if `message` field contains INFO
              when.contains:
                message: "INFO"
           - key: "debug_list"  # send to debug_list if `message` field contains DEBUG
             when.contains:
               message: "DEBUG"
           - key: "%{[type]}"
              mapping:
                "http": "frontend_list"
                "nginx": "frontend_list"
                "mysql": "backend_list"
      
  • passport

  • db

  • datatype

用于发布事件的Redis数据类型。如果数据类型为列表,则使用Redis RPUSH命令,并将所有事件添加到列表中,并在键下定义键。 如果使用数据类型通道,则使用Redis PUBLISH命令,这意味着所有事件都被推送到Redis的pub / sub机制。 通道的名称是键下定义的。 默认值为列表。

  • codec
  • worker
  • loadbalance
  • timeout
  • max_retries
  • bulk_max_size
  • ssl
  • proxy_url
  • proxy_use_local_resolver

File OutPut

文件输出将事务转储到每个事务处于JSON格式的文件中。 目前,该输出用于测试,但可以作为Logstash的输入

output.file:
  path: "/tmp/filebeat"
  filename: filebeat
  #rotate_every_kb: 10000
  #number_of_files: 7
  • enables
  • path
    • 定义保存文件的路径
  • filename
    • 定义保存文件的名字
  • rotate_every_kb
    • 定义每个文件达到多少kb就开始切割
  • number_if_files
    • 定义保存几份文件
  • codec

Console OutPut

output.console:
  pretty: true
  • pretty
  • codec
  • enabled
  • bulk_max_size

Codec Output

output.console:
  codec.json:
    pretty: true
output.console:
  codec.format:
    string: '%{[@timestamp]} %{[message]}'

Loggin OutPut

logging.level: warning
logging.to_files: true
logging.to_syslog: false
logging.files:
  path: /var/log/mybeat
  name: mybeat.log
  rotateeverybytes: 10MB 
  keepfiles: 7

Debugging

By default, Filebeat sends all its output to syslog. When you run Filebeat in the foreground, you can use the -e command line flag to redirect the output to standard error instead. For example:

filebeat -e

The default configuration file is filebeat.yml (the location of the file varies by platform). You can use a different configuration file by specifying
the -c flag. For example:

filebeat -e -c myfilebeatconfig.yml

You can increase the verbosity of debug messages by enabling one or more debug selectors. For example, to view the published transactions, you can start Filebeat with the publish selector like this:

filebeat -e -d "publish"

If you want all the debugging output (fair warning, it’s quite a lot), you can use *, like this:

filebeat -e -d "*"

support

https://www.elastic.co/support/matrix#show_compatibility

相关文章

  • filebeat_OutPut 介绍

    title: filebeat Output date: 2017-06-11 05:22:31 categori...

  • Runtime介绍---术语介绍

    1. 什么是Runtime Runtime又叫运行时,是一套C语言的API。 我们平时编写的OC代码,底层都是基于...

  • 介绍

    万物终有一天会消失殆尽,诸神出卖黎明,光明为黑暗所湮灭,日月皆痕,海潮鸣泣,幼雏嚎啕,生灵涂炭。 托里奥世纪第20...

  • 介绍😊

    大家好,我是beth,初入简书,不邀自来,还请各位见谅! 先说说我是怎么想着来的吧?这不是刚过了一个寒假嘛...

  • 介绍

    在这个世界上还有三个家族他们不受各个国家联合国管。但他们身上有着使命分别是帝国家族曲国家族圣国家族。他们隐藏在一个...

  • 介绍

    云轩:主角,星罗帝国的二皇子。从小就不能练气,被人们称为废物。直到12岁的时候,自己的武魂觉醒才能练气,双...

  • 介绍

    万花阁 神秘至极的组织,亦正亦邪。万花阁的人行动隐秘,至今未被发现所在地。听说组成成员均以花来命名。所到之处,皆留...

  • 介绍

    此书命曰元.八洲传。属九洲四传第二部。第一部,上古往事。上古往事乃元八洲传外传。前两部为战胜心魔,而第三部,大梦...

  • 介绍

    千肆篇 7月的天气燥热,但在红杏阁里这份燥热就别有一番风味。漫天的胭脂水粉的香味变成了调味剂,女人们千姿百媚,在...

  • 介绍

    该文集属于收录文集,里面的内容不全是本人创作,有收录个人喜欢的内容。 *(偏个人向)

网友评论

      本文标题:filebeat_OutPut 介绍

      本文链接:https://www.haomeiwen.com/subject/rvdhqxtx.html