首页 >> 大全

Logstash 与 Beats 入门

2023-11-30 大全 23 作者:考证青年

公号:码农充电站pro

主页:

目录 5,Beats 介绍

是一款免费开放的服务器端数据处理管道,能够从多个来源采集并转换数据,然后将数据发送到后端存储中。

1, 处理流程

的处理流程分为三个阶段,这三个阶段合称为一个 :

同时在输入/输出阶段可以对数据进行编解码处理。

用户通过配置文件告诉 如何处理数据。

2, 插件

的每个处理阶段都由一个或多个插件来完成, 目前支持 200 多个插件。

的一些常用插件:

阶段: 阶段: 编码处理: 3, Queue

实际处理数据时,会先将输入数据放入队列中,作为缓冲。

Queue 分为两种:

4, 使用示例

通过 -e 参数在命令行指定一个 ,通过 -f 参数指定一个配置文件。

4.1,-e 参数

通过 -e 在命令行指定一个 :

logstash -e "input{stdin{codec=>line}}output{stdout{codec=>rubydebug}}"
logstash -e "input{stdin{codec=>json}}output{stdout{codec=>rubydebug}}"
logstash -e "input{stdin{codec=>line}}output{stdout{codec=>dots}}"

入门级劳力士多少钱__入门必学10个手机摄影技巧

4.2,-f 参数

数据示例,一个 .csv 文件:

movieId,title,genres
1,Toy Story (1995),Adventure|Animation|Children|Comedy|Fantasy
2,Jumanji (1995),Adventure|Children|Fantasy
3,Grumpier Old Men (1995),Comedy|Romance
4,Waiting to Exhale (1995),Comedy|Drama|Romance
5,Father of the Bride Part II (1995),Comedy
6,Heat (1995),Action|Crime|Thriller
7,Sabrina (1995),Comedy|Romance
8,Tom and Huck (1995),Adventure|Children
9,Sudden Death (1995),Action
10,GoldenEye (1995),Action|Adventure|Thriller
11,"American President, The (1995)",Comedy|Drama|Romance
12,Dracula: Dead and Loving It (1995),Comedy|Horror
13,Balto (1995),Adventure|Animation|Children
14,Nixon (1995),Drama
15,Cutthroat Island (1995),Action|Adventure|Romance
16,Casino (1995),Crime|Drama
17,Sense and Sensibility (1995),Drama|Romance
18,Four Rooms (1995),Comedy
19,Ace Ventura: When Nature Calls (1995),Comedy
20,Money Train (1995),Action|Comedy|Crime|Drama|Thriller

配置文件 .conf:

input {        # 定义 inputsfile {       # 一个 file inputpath => "/path/movies.csv"start_position => "beginning"sincedb_path => "/dev/null"}
}filter {       # 定义 filterscsv {        # 一个 csv filterseparator => ","columns => ["id","content","genre"]}mutate {     # 一个 mutate filtersplit => { "genre" => "|" }remove_field => ["path", "host","@timestamp","message"]}mutate {     # 一个 mutate filtersplit => ["content", "("]add_field => { "title" => "%{[content][0]}"}add_field => { "year" => "%{[content][1]}"}}mutate {     # 一个 mutate filterconvert => {"year" => "integer"}strip => ["title"]remove_field => ["path", "host","@timestamp","message","content"]}
}output {             # 定义 outputselasticsearch {   # 一个 elasticsearch outputhosts => "http://localhost:9200"index => "movies"document_id => "%{id}"}stdout {}         # 一个 stdout output
}

5,Beats 介绍

Beats 是一个轻量型数据采集器,能够方便的与 和 配合使用。

Beats 是基于 开发的。

Beats 官方提供了一些具体的 beats 供我们使用:

(本节完。)

关于我们

最火推荐

小编推荐

联系我们


版权声明:本站内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 88@qq.com 举报,一经查实,本站将立刻删除。备案号:桂ICP备2021009421号
Powered By Z-BlogPHP.
复制成功
微信号:
我知道了