This guide walks through setting up Filebeat 8.17.4 on a separate Ubuntu VM to forward both CSV data and Apache web server logs into the ELK Stack.
💡 Ensure you have create a separate Ubuntu Server VM. You can refer to a YouTube tutorial if needed for VM setup.
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.17.4-linux-x86_64.tar.gz
tar xzvf filebeat-8.17.4-linux-x86_64.tar.gz
cd filebeat-8.17.4-linux-x86_64
Edit filebeat.yml
:
output.logstash:
hosts: ["192.168.1.4:5044"]
# Comment out the Elasticsearch output if enabled
# output.elasticsearch:
# hosts: ["localhost:9200"]
✅ Make sure your Logstash instance is running and reachable. ✅ Make sure to update the IP address with you Logstash IP address.
./filebeat test config
./filebeat test output
filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- /path/to/data.csv
📌 Replace
/path/to/data.csv
with the actual path to your CSV file.
./filebeat -e
logstash.conf
Input Blockinput {
beats {
port => 5044
}
}
output {
elasticsearch {
hosts => ["https://localhost:9200"]
user => "elastic"
password => "your_password"
ssl_enabled => true
ssl_verification_mode => "full"
ssl_certificate_authorities => ["/path/to/http_ca.crt"]
index => "filebeat-college-student"
}
stdout { codec => rubydebug }
}
🔐 Replace
/path/to/http_ca.crt
and credentials as per your setup.
Restart Logstash to apply changes.
filebeat-college-student
filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/apache2/access.log
- /var/log/apache2/error.log
fields:
log_type: apache
output.logstash:
hosts: ["192.168.1.4:5044"]
💡 Ensure Apache logs are available at the specified paths. You may simulate traffic using a Python HTTP server if needed.
input {
beats {
port => 5044
}
}
filter {
if [log_type] == "apache" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
date {
match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"]
}
geoip {
source => "[source][address]"
target => "[source][geo]"
}
if [user_agent] and [user_agent][original] {
useragent {
source => "[user_agent][original]"
}
}
}
}
output {
if [log_type] == "apache" {
elasticsearch {
hosts => ["https://localhost:9200"]
user => "elastic"
password => "your_password"
ssl_enabled => true
ssl_verification_mode => "full"
ssl_certificate_authorities => ["/path/to/http_ca.crt"]
index => "ubuntu-apache-webserver"
}
stdout { codec => rubydebug }
}
}
ubuntu-apache-webserver
All referenced images in this guide should be stored at:
/images/04-integrate-filebeat