Skip to content

Naresh240/elasticsearch-logstash-kibana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

elasticsearch-logstash-kibana

image

ELK search SetUp

Get GPG Key and Repo file from link

Import the Elasticsearch GPG Key:

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Create Repo file at /etc/elasticsearch with the name of elasticsearch.repo with belo content

[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Install Elasticsearch, Logstash and Kibana

yum install elasticsearch logstash kibana -y

If you want to see elastic search in UI, need to edit elasticsearch.yml shown as below

vi /etc/elasticsearch/elasticsearch.yml
--------------------------------------------------
network.host: 0.0.0.0
http.port: 9200
xpack.security.enabled: true         #also need to modify xpack.security.enabled as false
---------------------------------------------------

Start elasticsearch service

service elasticsearch start

Check status of Elastic Search

service elasticsearch status

Check elasticsearch in UI: Allow port=9200 in security group :9200

image

Kibana SetUp

Open "kibana.yml" and edit below details

vi /etc/kibana/kibana.yml
-------------------------------------------------
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://localhost:9200"]
-------------------------------------------------

Start kibana service

service kibana start

Check status of kibana

service kibana status

Check Kibana in UI: Allow port=5601 in security group :5601

image

Clone application and send logs to Elasticsearch

Create log file with below commands

cd springboot-elk

mkdir -p .mvn
echo "--add-opens java.base/java.lang=ALL-UNNAMED" > .mvn/jvm.config

Run application for logs:
   
mvn spring-boot:run
  
Check log file at /root/logback

Run logstash command to send logs to elasticsearch

cp logback.conf /usr/share/logstash/logback.conf        # copy logback configuration file
/usr/share/logstash/bin/logstash -f logback.conf        # sending logs to elastic search

image

Click on dashboard

image

Click on create new view

image

Click on save data view to kibana

image

Click on discover and see logs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages