I'm using filebeat to send logs to logstash, based on their filename - these logs are sent to specific indexes in elasticsearch. Filebeat works well, logstash receives the log files, but I can't seem to get the regex in my logstash config to check if the filenames contain a certain string working.
Here's how my logstash config looks
input {
beats {
port => 5044
}
}
filter {
csv {
separator => ","
columns => ["Order ID","Status","Remarks"]
}
}
output {
if [source] =~ "/path/to/my/logs/log-file-1*.csv" {
stdout {}
}
else if [source] =~ "/path/to/my/logs/log-file-2*.csv" {
stdout {}
}
else if [source] =~ "/path/to/my/logs/log-file-3*.csv" {
stdout {}
}
else if [source] =~ "/path/to/my/logs/log-file-4*.csv" {
stdout {}
}
}
I've removed the part that sends to elasticsearch. I expect the output of data being printed to the stdout, but there isn't any.
Am I referencing [source] the correct way?