Prerequities: 1. Ubuntu 20.0.4 as ELK and rsyslog server 2. Ubuntu Mate 16.04 armv7 as Raspberry Pi OS
Steps:
- Activate SSH in Raspberry Pi
- Run start.sh in Raspberry Pi
- Install docker in Ubuntu Server
- Install docker-compose in Ubuntu Server
- On Raspberry Pi, go to /etc/rsyslog.conf and uncomment: then add comment to: module(load="imklog" permitnonkernelfacility="on")
- On Raspberry Pi, go to /etc/rsyslog.d/50-default.conf and add one line before Log by facility. . @@192.168.1.13:514
- Restart rsyslog by: sudo systemctl restart rsyslog.service or sudo service rsyslog restart
- Check if port 514 is listening by: netstat plntu | grep "LISTEN "
- On Ubuntu Server, do the same as step #5
- Restart rsyslog by: sudo systemctl restart rsyslog.service or sudo service rsyslog restart
- Restart rsyslog by: sudo systemctl restart rsyslog.service or sudo service rsyslog restart
- On Ubuntu Server, Create new directory: elk-stack and go in.
- On Ubuntu Server, Add docker-compose.yml there.
- On Ubuntu Server, Add logstash.conf
- On Ubuntu Server, Run docker-compose up -d
- To see the status of the containers, type docker-compose ps
- To see logs, docker-compose logs -f. For seeing specific logs, e.g. logstash: docker-compose logs -f logstash
- Wait until the resources are successfully built.
- After that, it's time to install Filebeat on Ubuntu Server. Use the same version as ELK.
- wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.15.0-amd64.deb
- sudo dpkg -i filebeat-7.15.0-amd64.deb
- Enable filebeat module named System: sudo filebeat modules enable system
- Save the original file in another file: sudo cp /etc/filebeat/filebeat.yml /etc/filebeat/filebeat.yml.orig
- Go to /etc/filebeat/filebeat.yml and add the configuration.
- Create the Filebeat dashboards on the Kibana server: sudo filebeat setup
- Start the Filebeat service: sudo service filebeat start
- Configure the Filebeat service to start during boot time: sudo systemctl enable filebeat
- Now, go to 192.168.1.13:5601 => Analytics => Dashboard. Search Syslog. Your dashboard is ready!
- Before applying iptables rule, make sure all main devices are already connected to raspi so we can get their IP address to exclude from blacklist.
- Apply the iptables rule and monitor through Kibana server.
source: