Hi Community,
i'm looking for logstash idea how to parse the next content:
<15>#externalId=0#rt=1XXXX1#cs1=SaXXM XX-XXXXXX#cs1Label=XXX#dst=XX.XX.xx.xx#src=xx.xx.xx.xxx#duser=xxx_xxxx#suser=#shost=XXX-XXXXXXX#dproc=xxxxx#act=SELECT#cs2=SELECT XXXX,XXX,XXXX,XXXX,XXXXX FROM xxxxx.dbo.xxxxx WHERE xxxxx \\= @X1 AND (xxxxx is null) ORDER BY xxxxx ASC ,xxxxx ASC ,xxxxx ASC#cs3=#cs3Label=AccessedObjects#cs2Label=SqlStatement\u0000
i hashed the real values but the columns are real, also the delimiter is by request i customize the sender to delim using "#",
i tried the following config:
input {
tcp {
port => 5002
type => syslog
tags => ["dam"]
}
udp {
port => 5002
type => syslog
tags => ["dam"]
}
}
filter {
if "dam" in [tags] {
ruby {
code => "
fieldArray = event.get('message').split('#')
for field in fieldArray
field = field.delete('#')
result = field.split('=',1)
temp_key = 'key_' + result[0]
temp_value = 'value_' + result[1]
event.set(temp_key, temp_value)
end
"
}
}
}
i tried lot of trick even using KV, i believe i'm doing something wrong
[2017-01-29T00:04:10,785][ERROR][logstash.filters.ruby ] Ruby exception occurred: can't convert nil into String
Thanks in advance.