天天看点

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

Logstash啊,根据input来监控数据,根据output来使用数据!!!

手把手带你看官方文档(Logstash inputs和Logstash outputs)

<a href="https://www.elastic.co/guide/index.html">https://www.elastic.co/guide/index.html</a>

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

<a href="https://www.elastic.co/guide/en/logstash/index.html">https://www.elastic.co/guide/en/logstash/index.html</a>

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

<a href="https://www.elastic.co/guide/en/logstash/2.4/index.html">https://www.elastic.co/guide/en/logstash/2.4/index.html</a>

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

  

  关于 Logstash inputs、Logstash outputs和Filter plugins,很多很多,自行去官网看,我这里不多赘述。仅仅拿下面来示范:

Logstash 的input

file input

  最常用的input插件是file。

<a href="https://www.elastic.co/guide/en/logstash/2.4/plugins-inputs-file.html">https://www.elastic.co/guide/en/logstash/2.4/plugins-inputs-file.html</a>

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

  这个,是可以自定义的。我这里是

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

  我这里是, 监控/home/hadoop/app.log这个文件的变化。

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

  重新打开,另外一个HadoopMaster界面。

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

  其实,这个文件,.sincedb_8f3299d0a5bdb7df6154f681fc150341也会记录。

 注意:

   第一次读取新文件,不会有.sincedb等这些,默认根据这个start_position去读,若start_position是end,则读最后。若start_position是begin,则读最开始。

若不是第一次读取文件了,重启Logstash,则会有.sincedb文件了,则就转去根据这个.sincedb文件读了。不管start_position是什么,都不起效了。

  start_position:指定从什么位置开始读取文件数据,默认是结束位置,也可以指定为从头开始。

注意:start_position仅在该文件从未被监听过的时候起作用,因为logstash在读取文件的时候会记录一个.sincedb文件来跟踪文件的读取位置,当文件被读取过一次之后,下次就会从.sincedb中记录的位置读取,start_position参数就无效了。文件默认在用户目录下。

  注意一个坑:ignore_older属性,表示忽略老的数据,值默认为86400,表示忽略24小时以前的数据。如果你新监控一个24小时以上没有被修改过的老文件的话,就算把start_position设置为beginning,也无法获取之前的数据。

redis input

<a href="https://www.elastic.co/guide/en/logstash/2.4/plugins-inputs-redis.html">https://www.elastic.co/guide/en/logstash/2.4/plugins-inputs-redis.html</a>

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

   这里,用到redis,不会用的博友,请移步

   这里,等我安装好了之后,再来。

Logstash 的output

redis output

<a href="https://www.elastic.co/guide/en/logstash/2.4/plugins-outputs-redis.html">https://www.elastic.co/guide/en/logstash/2.4/plugins-outputs-redis.html</a>

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

elasticsearch output

  即把Logstash里的数据,写到elasticsearch 集群(这台192.168.80.10里)

  1.x中属性名称叫host

默认向es中创建的索引库是logstash-%{+YYYY.MM.dd},可以利用es中的索引模板特性定义索引库的一些基础配置。

Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)
Logstash之Logstash inputs(file和redis插件)、Logstash outputs(elasticsearch 和redis插件)和Filter pluginsredis的安装(图文详解)

继续

Filter plugins

<b>本文转自大数据躺过的坑博客园博客,原文链接:</b><b>http://www.cnblogs.com/zlslch/p/6624457.html</b><b>,如需转载请自行联系原作者</b>

继续阅读