作者:Sunday老师 | 来源:互联网 | 2023-02-06 17:55
1.Elasticsearch安装和Logstash安装环境参照https:blog.csdn.netqq_33371766articledetails1033227072.启动
1.Elasticsearch安装和Logstash安装环境参照https://blog.csdn.net/qq_33371766/article/details/103322707
2.启动elasticsearch和kibana
3.在logstash准备同步的log和conf文件
根据图示创建文件夹和文件
3.1 myfile.conf (根据实际情况修改path的路径和es的服务地址)
input {file {path =>"D:\workTool\logstash-6.3.2\myfileconfig\log_info.log"type=>"info_log" #类型名称}
}output {elasticsearch {hosts => ["192.168.75.1:9200"]index => "info_index" #索引名称}stdout { codec => json_lines }
}
3.2 info_log.log (这里添加了3条数据,是一条一条添加的,logstash会实时的同步到es中)
===2019-12-16 19:25:13.361 INFO com.zaxxer.hikari.HikariDataSource Line:110 - HikariPool-1 - Starting...
===2019-12-16 19:33:18.582 ERROR com.zaxxer.hikari.HikariDataSource Line:123 - HikariPool-1 - Start completed.
===2019-10-02 22:40:15.010 WARN org.springframework.boot.devtools.autoconfigure.OptionalLiveReloadServer Line:61 - Unable to start LiveReload server
4.验证es中的数据
数据同步成功!
es的查询语句可以参考https://blog.csdn.net/tuntun1120/article/details/80322801