Logstash-input-file 配置
在windows下,新建一个 config_file.conf 配置文件
开始logstash的时候,新建一个 run_file.bat 批处理,内容是 logstash -f config_file.conf
运行 run_file.bat 批处理文件就行了
file.txt 文件内容
{"name": "zhangsan", "age": 21, "addr": "中国 北京"} {"name": "lisi", "age":20,"addr":"美国"} {"name": "wangwu","age":19,"addr":"beijing"}
config_file.conf 文件配置
input { file { path => ["D:/tmp/file.txt"] start_position => "beginning" codec => "json" } } filter { } output { stdout {} }
注意 路径的 /
官方配置说明地址:https://www.elastic.co/guide/en/logstash/7.1/plugins-inputs-file.html#plugins-inputs-file-start_position