ELK stack
ELK stack
Centralized logging
ELK
Elastic Stack
These three projects are used together for log analysis in various environments.
- Logstash collects and parses logs,
- Elastic search indexes and store this information.
- Kibana provides a UI layer that provide actionable insights.
Elastic Stack
Pull Pull
logs Pull
logs
logs
Elastic Stack
Elastic Stack
https://github.com/Java-Techie-jt/elk-stack-logging-example
Elastic Stack
Open elasticsearch.yml
# Enable security features
xpack.security.enabled: false
localhost:9200
Elastic Stack
Download Kibana
https://www.elastic.co/downloads/kibana
localhost:5601
Elastic Stack
Download logstash
https://www.elastic.co/downloads/logstash
Elastic Stack
Download filebeat
https://www.elastic.co/downloads/beats/filebeat
Elastic Stack
cmd
cmd
https://www.elastic.co/guide/en/logstash/current/first-event.html
Elastic Stack
input {
stdin {
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "hellodb"
Run in bin files:
}
}
logstash -f ./config/cmd-elastic.conf --config.reload.automatic
Elastic Stack
Delete registry folder
C:\Users\admin\Downloads\filebeat-8.8.0-windows-x86_64\data\registry
filebeat.inputs:
- type: log
paths:
- C:/Users/admin/Downloads/logstash-
tutorial-dataset.txt
output.console:
pretty: true
Run in filebeat-8.8.0-windows-x86_64:
filebeat -e -c filebeat-cmd.yml -d "publish"
Elastic Stack
filebeat-logstash.yml first-pipeline.conf
input {
beats {
filebeat.inputs: port => "5044"
- type: log }
paths: }
- C:/Users/admin/Downloads/logstash- # The filter part of this file is
tutorial-dataset.txt commented out to indicate that it is
output.logstash: # optional.
hosts: ["localhost:5044"] # filter {
#
# }
output {
stdout {}
}
Elastic Stack
Delete registry folder
C:\Users\admin\Downloads\filebeat-8.8.0-windows-x86_64\data\registry
2 1
Filebeat-logstash.yml first-pipeline.conf
logstash -f ./config/first-pipeline.conf --
filebeat -e -c filebeat-logstash.yml -d "publish"
config.reload.automatic
https://www.elastic.co/guide/en/logstash/current/advanced-pipeline.html
Elastic Stack
logstash-elastic.conf
input {
beats {
port => "5044"
}
}
logstash -f ./config/logstash-elastic.conf --
config.reload.automatic
filebeat -e -c filebeat-logstash.yml -d
"publish"
output {
stdout { codec => rubydebug }
elasticsearch {
hosts => ["http://localhost:9200"]
index => "logdb"
}
}
Elastic Stack
https://github.com/Java-Techie-jt/elk-stack-logging-example