Preface
Before, we installed and configured the rsyslog , MySQL and LogAnalyzer.
Now we use anothor tools to help us collect logs , and get better statistics.
Objective
Deploy the ELK and get statistics to analyze logs.
System environvent
Transport iptables log file to log server
Same environment in this note,and install the ELK in log server.
Install ELK
Install Java-OpenSDK
1 | yum install java |
Download ElasticSearch and extract it
1 | wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.0-linux-x86_64.tar.gz |
modify config file from config/elasticsearch.yml
1 | cluster.name: log-elasticsearch |
Download Kibana and extract it
1 | wget https://artifacts.elastic.co/downloads/kibana/kibana-7.3.0-linux-x86_64.tar.gz |
modify config file from config/kibana.yml
1 | server.port: 5601 |
Download Logstash and extract it
1 | wget https://artifacts.elastic.co/downloads/logstash/logstash-7.3.0.tar.gz |
Transport method
Transport rsyslog log files through LogStash
Logstash config file
1 | imput{ |
start up logstash
1 | bin/logstash -f config/syslog.conf |
Transport log files through Filebeat
Download filebeat plugin
1 | https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.0-linux-x86_64.tar.gz |
Modify filebeat config from ./filebeat.yml
1 | #=====Filebeat inputs===== |
Browse kibana/discover then can show log in screen.
Some Errors
Insufficient space for shared memory file
clean the disk.
1 | df -h |
Create Kibana index pattern forbidden
1 | curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}' |
Screenshot
Reference
ELK 常用架构及使用场景介绍
集中式日志系统 ELK 协议栈详解
ELK 錯誤訊息 max file descriptors [4096] for elasticsearch process is too low
elasticsearch 7 单机配置