regex - Fluentd filter to exclude key with empty value -


i want exclude row have serive_name empty "service_name":"". here fluentd conf

## match tag=debug.** , dump console <match debug.**>   @type stdout </match> <source>   @type tail   path  /opt/wso2esb-4.9.0-wkr-1/repository/logs/wso2carbon.log   pos_file /var/log/td-agent/tmp/wso2carbon.log.pos   tag debug.wso2.esb   format /^([tid:]* [^ ]* [^ ]* \[(?<time>[^\]]*)\]) ([^ ]* (?<level>[^ ]*))([^***]*[^=]*[^ ]*(?<service_name>[^,]*)[^=]*[^ ]*(?<step>[^,]*)[^ ]*[^=]*[^ ]*(?<message_id>[^,]*))/   time_format %y-%m-%d %h:%m:%s #  keep_time_key true </source> 

here log out-put

2017-08-21 09:57:10 +0700 debug.wso2.esb: {"level":"info","service_name":" sa_vasgwlogseq","step":" before vasgwinsertlog","message_id":" urn:uuid:2046f0ed-690d-47b1-aa86-d4a71c021a74"} 2017-08-21 09:57:10 +0700 debug.wso2.esb: {"level":"info","service_name":"","step":"","message_id":""} 2017-08-21 09:57:10 +0700 debug.wso2.esb: {"level":"info","service_name":" sa_vasgwlogseq","step":" after vasgwinsertlog","message_id":" urn:uuid:2046f0ed-690d-47b1-aa86-d4a71c021a74"} 2017-08-21 10:16:10 +0700 debug.wso2.esb: {"level":"info","service_name":" service_name","step":" before - sa_serviceapidsep","message_id":" urn:uuid:39e0ecc1-dda5-4cd9-91fc-90e7ed4f5233"} 

i want exclude below row. how that?

{"level":"info","service_name":"","step":"","message_id":""} 

the second question why have space before value "service_name":" service_name", when try on fluentular nice output without space.

i have solved second quest add space regex. e.g. change

[^=]*[^ ]*(?<service_name>[^,]*) [^=]*[^ ]* (?<service_name>[^,]*).


but don't know how write filter exclude record key_name have empty value "service_name":"".


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -