Extend the disk, you must have atleast 60GB
sudo growpart /dev/nvme0n1 4sudo lvextend -L +20G /dev/RootVG/rootVol
sudo lvextend -L +20G /dev/RootVG/varVolsudo xfs_growfs /sudo xfs_growfs /varAdd the repo
vim /etc/yum.repos.d/elasticsearch.repo[elasticsearch]
name=Elasticsearch repository for 9.x packages
baseurl=https://artifacts.elastic.co/packages/9.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
type=rpm-mdInstall elasticsearch, kibana, logstash
dnf install elasticsearch kibana logstash nginx -ysystemctl start elasticsearch
systemctl start kibanaWe can use nginx as reverse proxy for easy web access
rm -rf /etc/nginx/nginx.confuser nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
## Kibana Config
upstream kibana {
server 127.0.0.1:5601;
keepalive 15;
}
server {
listen 80;
location / {
proxy_pass http://kibana;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
}Generate an enrollment token for Kibana instance.
/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibanaKibana Verification
/usr/share/kibana/bin/kibana-verification-codeReset admin password
/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elasticCreate one EC2 for filebeat
Add the repo
vim /etc/yum.repos.d/elasticsearch.repo[elasticsearch]
name=Elasticsearch repository for 9.x packages
baseurl=https://artifacts.elastic.co/packages/9.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
type=rpm-mddnf install filebeat -y
Install any application to get the logs, I am installing nginx here
dnf install nginx -y
systemctl start nginx
Let's push nginx logs to elasticsearch. Edit the filebeat config.
vim /etc/filebeat/filebeat.ymlenabled: true
inputs: nginx access log
outputs: elastic
ssl_verification: none
protocol: https
- Go to stack management and see the data in index management
- Create an index for that
- Now we can see logs in disover
systemctl start logstash
logstash configuration
vim /etc/logstash/conf.d/nginx-access-log.conf
Edit filebeat config to send logs to logstash
Create index again, and see the logs are converted to structured
helm repo add elastic https://helm.elastic.cohelm install filebeat elastic/filebeat -f filebeat.yml
Change logstash config to receive EKS container logs. Final logstash config is