server.example.com (ELK master)
client.example.com (client machine)
yum install -y java-1.8.0-openjdk
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cat >>/etc/yum.repos.d/elk.repo<<EOF
[ELK-6.x]
name=ELK repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
yum install -y elasticsearch
systemctl daemon-reload
systemctl enable elasticsearch
systemctl start elasticsearch
yum install -y kibana
systemctl daemon-reload
systemctl enable kibana
systemctl start kibana
yum install -y epel-release
yum install -y nginx
Remove server block from the default config file /etc/nginx/nginx.conf And create a new config file
cat >>/etc/nginx/conf.d/kibana.conf<<EOF
server {
listen 80;
server_name server.example.com;
location / {
proxy_pass http://localhost:5601;
}
}
EOF
systemctl enable nginx
systemctl start nginx
yum install -y logstash
openssl req -subj '/CN=server.example.com/' -x509 -days 3650 -nodes -batch -newkey rsa:2048 -keyout /etc/pki/tls/private/logstash.key -out /etc/pki/tls/certs/logstash.crt
vi /etc/logstash/conf.d/01-logstash-simple.conf
Paste the below content
input {
beats {
port => 5044
ssl => true
ssl_certificate => "/etc/pki/tls/certs/logstash.crt"
ssl_key => "/etc/pki/tls/private/logstash.key"
}
}
filter {
if [type] == "syslog" {
grok {
match => {
"message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}"
}
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
output {
elasticsearch {
hosts => "localhost:9200"
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
}
}
systemctl enable logstash
systemctl start logstash
cat >>/etc/yum.repos.d/elk.repo<<EOF
[ELK-6.x]
name=ELK repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
yum install -y filebeat
scp server.example.com:/etc/pki/tls/certs/logstash.crt /etc/pki/tls/certs/
[Refer my youtube video]
systemctl enable filebeat
systemctl start filebeat
All done. Now you can head to Kibana dashboard and add the index.