Loading... 今天花了比较久的时间,搭建了ELK日志分析平台,做下笔记,免得忘记了。 以下是运行结果: ![微信截图_20181026133929.png][1] [1]: http://blog.pingchas.com/usr/uploads/2018/10/3691061271.png 我采用的是Windows上运行Elastsearch6.4.2+Kibana6.4.2 Linux上运行Logstash6.4.2 主要使用Logstash采集系统的日志。 Windows机器上的Elasticsearch配置。 network.host: 192.168.109.1 因为使用VM虚拟机,分配了这个IP给我,以便Linux与本机互通。 然后启动elasticsearch-6.4.2\bin\elasticsearch.bat 如果顺利,过会在浏览器输入地址 http://192.168.109.1:9200 如果出现如下数据,证明启动成功 { "name" : "HNe2XoQ", "cluster_name" : "elasticsearch", "cluster_uuid" : "ldjt09T-TD6NM5TWwgU2DA", "version" : { "number" : "6.4.2", "build_flavor" : "default", "build_type" : "zip", "build_hash" : "04711c2", "build_date" : "2018-09-26T13:34:09.098244Z", "build_snapshot" : false, "lucene_version" : "7.4.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" } 然后配置Linux上的Logstash。 新建一个文件logstash.conf,内容如下: input { syslog { type => "system-syslog" port => 10514 } } output { elasticsearch { hosts => ["192.168.109.1:9200"] # 定义es服务器的ip index => "system-syslog-%{+YYYY.MM}" # 定义索引 } } 修改配置文件(运行Logstash的IP为192.168.109.128): http.host: "192.168.109.128" 最后配置系统日志:vim /etc/rsyslog.conf,内容为: #### RULES #### *.* @@192.168.109.128:10514 重启服务 services rsyslog restart 然后启动Logstash,进入logstash-6.4.2/bin目录 ./logstash -f /root/logstash-6.4.2/config/logstash.conf 查看是否正常: Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1172/rpcbind tcp 0 0 0.0.0.0:43186 0.0.0.0:* LISTEN 1190/rpc.statd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1446/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1331/cupsd tcp 0 0 :::111 :::* LISTEN 1172/rpcbind tcp 0 0 :::10514 :::* LISTEN 4928/java tcp 0 0 :::22 :::* LISTEN 1446/sshd tcp 0 0 ::1:631 :::* LISTEN 1331/cupsd tcp 0 0 ::ffff:192.168.109.128:9600 :::* LISTEN 4928/java tcp 0 0 :::49473 :::* LISTEN 1190/rpc.statd udp 0 0 0.0.0.0:111 0.0.0.0:* 1172/rpcbind udp 0 0 0.0.0.0:631 0.0.0.0:* 1331/cupsd udp 0 0 0.0.0.0:56332 0.0.0.0:* 1190/rpc.statd udp 0 0 0.0.0.0:10514 0.0.0.0:* 4928/java udp 0 0 0.0.0.0:923 0.0.0.0:* 1172/rpcbind udp 0 0 0.0.0.0:942 0.0.0.0:* 1190/rpc.statd udp 0 0 0.0.0.0:68 0.0.0.0:* 2203/dhclient udp 0 0 :::111 :::* 1172/rpcbind udp 0 0 :::923 :::* 1172/rpcbind udp 0 0 :::53201 :::* 1190/rpc.statd 当列表中有9600和10151时证明服务正常。 接下来启动Kibana。 配置: 修改config/kibana.yml elasticsearch.url: "http://192.168.109.1:9200" 最后启动: bin/kibana.bat Last modification:October 26, 2018 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 0 如果觉得我的文章对你有用,请随意赞赏