案例
从客户端PC推送csv文件到服务器端elastic
橡皮筋已经装好了,很好。我可以从我的pc访问它,并使用演示数据。现在我想学习如何用我自己的数据来推送它。我已经准备好了来自kaggle的数据。
客户端
我已经在客户端下载了filebeat并将其解压缩。我已经将filebeat.yml编辑为
filebeat.inputs:
- input_type: log
paths:
- C:\Users\Charles\Desktop\DATA\BrentOilPrices.csv
document_type: test_log_csv
output.logstash:
hosts: ["10.64.2.246:5044"]我还用以下命令进行了测试
./filebeat test config它返回: Config Ok
服务器端
已编辑的logstash.conf为
input {
beats {
port =>5044
}
}
filter {
if "test_log_csv" in [type]
{
csv {
columns=>["Date","Price"]
separator=>","
}
mutate{
convert => ["Price","integer"]
}
date{
match=>["Date","d/MMM/yy"]
}
}
}
output {
if "test_log_csv" in [type]
{
elasticsearch
{
hosts=>"127.0.0.1:9200"
index=>"test_log_csv%{+d/MM/yy}"
}
}客户端
我跑步
Start-Service filebeat它不返回任何内容。
我检查了我的kibana,没有日志。我错过了什么?
在客户端编辑filebeat.yml
filebeat.inputs:
- input_type: log
paths:
- 'C:\Users\Charles\Desktop\DATA\BrentOilPrices.csv'
fields:
document_type: test_log_csv
output.logstash:
hosts: ["10.64.2.246:5044"]发布于 2019-11-14 21:14:13
在版本6.X中,从Filebeat中删除了document_type选项,因此不再创建type字段,因为您的条件是基于此字段的,因此您的管道将不起作用。此外,即使在windows上,也应该尝试使用正斜杠(/)。
尝试更改以下配置,然后再次测试。
filebeat.inputs:
- input_type: log
paths:
- 'C:/Users/Charles/Desktop/DATA/BrentOilPrices.csv'
fields:
type: test_log_csv
fields_under_root: true
output.logstash:
hosts: ["10.64.2.246:5044"]选项fields_under_root: true将在文档的根目录中创建字段type,如果删除该选项,该字段将被创建为[fields][type],您需要将条件更改为该字段。
https://stackoverflow.com/questions/58833999
复制相似问题