Hi,
I am trying to parse Oracle listener.log
file. Here is a sample:
29-NOV. -2017 14:34:48 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=localhost)(USER=grid))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=203424000)) * status * 0
29-NOV. -2017 14:34:48 * version * 0
29-NOV. -2017 14:34:49 * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.1)(PORT=10484)) * service_register * LsnrAgt * 0
29-NOV. -2017 14:34:52 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=localhost)(USER=grid))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=203424000)) * status * 0
29-NOV. -2017 14:35:53 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=localhost)(USER=grid))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=203424000)) * status * 0
29-NOV. -2017 14:36:53 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=localhost)(USER=grid))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=203424000)) * status * 0
29-NOV. -2017 14:37:48 * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.1)(PORT=10488)) * service_register * +ASM * 0
29-NOV. -2017 14:37:51 * service_update * +ASM * 0
I have successfully extracted the message part using a grok filter, and I now want to parse this (CONNECT_DATA=(CID=(PROGRAM=)(HOST=localhost)(USER=grid))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=203424000))
.
The target should be
{
"connect_data": {
"cid": {
"program": "",
"host": "localhost",
"user": "grid"
},
"command": "status",
"arguments": 64,
"service": "listener",
"version": 20342400
}
}
This looks like a nested key-value, so I tried with this configuration
kv {
source => "connect_data"
include_brackets => "false"
recursive => "true"
transform_key => "lowercase"
value_split => "="
trim_key => "\(\)"
trim_value => "\(\)"
}
and multiple variants of it (such as include_brackets=false
but without trimming, include_brackets=true
and with trimming).
Is there a way to parse this format with the kv
filter? If not, what are the alternatives?
Thanks for you answers