Hello
I have a logstash that receive log from other logstash using tcp:
input {
tcp {
port => 65009
mode => server
id => "wm-id"
tags => "wm"
codec => line
}
}
In output, I put this syslog into file:
filter {
ruby {
code => '
if File.readlines("/proc/mounts").any?{ |line| line.split(" ")[0] == "/dev/drbd0" }
#logger.info("drbd is mounted.");
else
logger.info("drbd is not mounted. I drop every event");
event.cancel;
end
'
}
ruby {
code => "event.set('index_day', event.get('[@timestamp]').time.localtime.strftime('%Y%m%d%H'))"
}
grok {
match => ["message", "%{SYSLOGTIMESTAMP:date} %{IPORHOST:hostname} %{GREEDYDATA:message}"]
overwrite => [ "message"]
}
}
output {
if "wm" in [tags] {
file {
#questo server per avere nel file solo log vero e proprio
codec => line {
format => "%{message}"
}
path => "/drbd/web-logs/wm-%{index_day}.log"
}
}
}
I tried with different filter to remove, before to write into file, timestamp and source ip.
The genuine log is:
xxx.xxx.62.231 1571064805.792 4766 xxx.xxx.35.86 64375 0 TUNNELED 5593 2406 unknown ssl ssl://kkkkk-t.kkkkk.tv:443/ kkkk k-t.kkkkk.tv - - OBSERVED Web%20Ads/Analytics -
write into log file is:
2019-10-14T14:53:26.127Z vlan22.tt-hhhhh.foo.com xxx.xxx.62.231 1571064805.792 4766 xxx.xxx.35.86 64375 0 TUNNELED 5593 24 06 unknown ssl ssl://kkkkk-t.kkkkk.tv:443/ kkkkk-t.kkkkk.tv - - OBSERVED Web%20Ads/Analytics -
I want to remove "2019-10-14T14:53:26.127Z" and "vlan22.tt-hhhhh.foo.com".
Please can I help me?
Thank you