Filebeat将csv导入es尝试

一、安装

在docker中安装部署ELK+filebeat

二、主要配置

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| - type: log ``# Change to true to enable this input configuration. ``enabled: true ``# Paths that should be crawled and fetched. Glob based paths. ``paths: ``- /home/centos/pip_v2.csv #源路径 ``#- c:\programdata\elasticsearch\logs\* ``#exclude_lines: ["^Restaurant Name,"] #第一行为字段头以"Restaurant Name"开头,不要第一行 ``multiline: ``pattern: ^\d{4} ``#pattern: ',\d+,[^\",]+$' ``negate: true ``match: after ``max_lines: 1000 ``timeout: 30s |

三、关于elastic的pipline

https://hacpai.com/article/1512990272091

我简单介绍主流程,详情见上链接

1.开启数据预处理,node.ingest: true

2.向es提交pipline,并命名为my-pipeline-id

PUT _ingest/pipeline/my-pipeline-id

{

"description" : "describe pipeline",

"processors" : [

{

"set" : {

"field": "foo",

"value": "bar"

}

}

]

}

3.以上pipline的作用

若产生新的数据,会新增一个字段为foo:bar

4.curl的pipline即时测试

POST _ingest/pipeline/_simulate

是一个测试接口,提供pipline的规则和测试数据,返回结果数据

四、关于grok

是pipline中的正则匹配模式,以上规则的复杂版

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| POST _ingest/pipeline/_simulate { ``"pipeline": { ``"description": "grok processor", ``"processors" : [ ``{ ``"grok": { ``"field": "message", ``"patterns": ["%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}"] ``} ``} ``] ``}, ``"docs": [ ``{ ``"_index": "index", ``"_type": "type", ``"_id": "id", ``"_source": { ``"message": "55.3.244.1 GET /index.html 15824 0.043" ``} ``} ``] } |

五、使用pipline导入csv

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| utput.elasticsearch: ``# Array of hosts to connect to. ``hosts: ["localhost:9200"] ``#index: "csvindex" ``pipline: "my-pipeline-id" ```# Protocol - eitherhttp(default) orhttps.`` ``#protocol: "https"` |

测试结果pipline配置后,并没生效。

六、结论

1.filebeat 导入csv的资料很少,主要为pipline方式,测试几个失败。

2.J和数据组并没有filebaeat 导入csv的成功案例。J不太建议使用

结论:filebeat导csv并不方便,建议采用logstash。

一般日志收集可使用logstash,每行的信息会存到message中

相关推荐
NGINX开源社区2 小时前
使用 NGINX 作为 AI Proxy
大数据·人工智能·nginx
雪兽软件8 小时前
如何从目标到决策构建大数据战略?
大数据
数据皮皮侠9 小时前
中国城市间地理距离矩阵(2024)
大数据·数据库·人工智能·算法·制造
ToB营销学堂10 小时前
B2B营销自动化新解法:MarketUP聚焦高转化场景
大数据·运维·自动化
TK云大师-KK10 小时前
TikTok自动化直播遇到内容重复问题?这套技术方案了解一下
大数据·运维·人工智能·矩阵·自动化·新媒体运营·流量运营
小飞Coding13 小时前
ES 性能调优核心:读懂线程栈,告别“请求被拒绝”与“集群卡顿”
elasticsearch
昨夜见军贴061613 小时前
AI审核守护生命设备安全:IACheck成为呼吸机消毒效果检测报告的智能审核专家
大数据·人工智能·安全
Elastic 中国社区官方博客13 小时前
现已正式发布: Elastic Cloud Hosted 上的托管 OTLP Endpoint
大数据·运维·数据库·功能测试·elasticsearch·全文检索
D愿你归来仍是少年14 小时前
Flink 并行度变更时 RocksDB 状态迁移的关键机制与原理
大数据·flink·apache
小飞Coding14 小时前
一文吃透 Elasticsearch 索引模板+别名:零误导、可复现的生产级实践
elasticsearch