When I am setting up my ELK without SSL configuration, I was able to setup Cowrie logstash in my logstash-cowrie.log and inside my filebeat.yml file.
The link from the ELK with SSL configuration:
I have created another ELK with the SSL configuration settings in it, apparently it is unable to pass the logs in there. From my ELK server I found out that there was this line in it.
[INFO ][logstash.outputs.elasticsearch][main] Not eligible for data streams because config contains one or more settings that are not compatible with data streams: {"ilm_rollover_alias"=>"cowrie-logstash", "ilm_enabled"=>"auto"}
The sample of my beats file from the guide that I have followed:
input {
beats {
port => 5044
ssl => true
ssl_certificate_authorities => ["/etc/logstash/certs/http_ca.crt"]
ssl_certificate => "/etc/logstash/certs/logstash.crt"
ssl_key => "/etc/logstash/certs/logstash.key"
ssl_verify_mode => "force_peer"
}
}
filter {
grok {
match => { "message" => "%{SYSLOGLINE}" }
}
date {
match => ["timestamp", "MMM dd HH:mm:ss"]
}
}
output {
elasticsearch {
ssl => true
hosts => ["https://<ELK IP>:9200"]
cacert => "/etc/logstash/certs/http_ca.crt"
user => "logstash_internal"
password => "demo-password"
}
}
Original logstash-cowrie.conf file that would be in /etc/logstash/conf.d
input {
# filebeats
beats {
port => 5044
type => "cowrie"
}
# if you don't want to use filebeat: this is the actual live log file to monitor
#file {
# path => ["/home/cowrie/cowrie-git/log/cowrie.json"]
# codec => json
# type => "cowrie"
#}
}
filter {
if [type] == "cowrie" {
json {
source => message
target => honeypot
}
date {
match => [ "timestamp", "ISO8601" ]
}
if [src_ip] {
mutate {
add_field => { "src_host" => "%{src_ip}" }
}
dns {
reverse => [ "src_host" ]
nameserver => [ "8.8.8.8", "8.8.4.4" ]
action => "replace"
hit_cache_size => 4096
hit_cache_ttl => 900
failed_cache_size => 512
failed_cache_ttl => 900
}
geoip {
source => "src_ip"
target => "geoip"
database => "/opt/logstash/vendor/geoip/GeoLite2-City.mmdb"
}
}
mutate {
# cut out useless tags/fields
remove_tag => [ "beats_input_codec_plain_applied"]
remove_field => [ "[log][file][path]", "[log][offset]" ]
}
}
}
output {
if [type] == "cowrie" {
elasticsearch {
hosts => ["<ELK IP>:9200"]
ilm_enabled => auto
ilm_rollover_alias => "cowrie-logstash"
}
#file {
# path => "/tmp/cowrie-logstash.log"
# codec => json
#}
stdout {
codec => rubydebug
}
}
}
Filebeat.yml file
filebeat.inputs:
- type: filestream
id: syslog
paths:
- /var/log/syslog
- /cowrie/cowrie/var/log/cowrie/cowrie.json*
setup.template.settings:
index.number_of_shards: 1
logging.level: info
output.logstash:
hosts: ["<ELK IP>:5044"]
ssl.enabled: true
ssl.certificate_authorities: ["/etc/filebeat/certs/http_ca.crt"]
ssl.certificate: "/etc/filebeat/certs/client.crt"
ssl.key: "/etc/filebeat/certs/client.key"
pipelining: 4