2.logstash概述

Logstash概述

1.logstash 主要有三个组件组成。

image
image
image

  • input plugin : 主要是用于定义从哪些地方可以采集数据。
  • output plugin: 主要是定义将采集好的数据保存到哪里去。
  • filter plugin: 主要是对采集的数据作加工和转换格式的一些工作。

2.安装

elastic 依赖java,一定要之前先安装java
去elastic 下载即可

3.启动

 elasticsearch #可以直接启动
  elasticsearch -f  test.conf #指定配置文件
  /usr/share/logstash/bin/logstash-plugin --help  #查找帮助信息
  logstash-plugin list --group input|output|filter|codec|integration

image

练习1
vim heartbeat.yml
#自动输出心跳内容,间隔为10秒
input {
  heartbeat {
        interval => 10
        type => "heartbeat"
        }
}

output {
        stdout {
        codec => rubydebug
}
}

logstash -f hearbeat.yml
------ 输出 ---------
{
          "host" => "localhost.localdomain",
       "message" => "ok",
      "@version" => "1",
          "type" => "heartbeat",
    "@timestamp" => 2021-11-12T15:14:46.325Z
}
{
          "host" => "localhost.localdomain",
       "message" => "ok",
      "@version" => "1",
          "type" => "heartbeat",
    "@timestamp" => 2021-11-12T15:14:56.301Z
}

posted @ 2021-11-12 21:06  mk-备忘  阅读(173)  评论(0)    收藏  举报