filter{ if "a" in [message] { grok { match => { "message" => "grok pattern A" } } }
else if "b" in [message] { grok { match => { "message" => "grok pattern B" } } }}I installed the grok parser plugin, but my problem is, how to do I insert the IF statement in the <source>?My current code is:<source>type tailpath /home/ubuntu/datos-prueba/*.logpos_file /var/log/td-agent/tmp/access.log.postag inputformat grok<grok>pattern A</grok>read_from_head true</source>Thanks and regards,
Hi,
You can use rewrite-tag-filter plugin for such purpose.
In addition, if your pattern is different, multi-forma-parser is another candidate.
Masahiro
--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
| filter{ | |
| if "String1" in [message] | |
| { | |
| grok { match => { "message" => "grok_pattern_A" } } | |
| } | |
| else if "String2" in [message] | |
| { | |
| grok { match => { "message" => "grok_pattern _B" } } | |
| } | |
| } |
| <source> @type tail | |
| path /home/ubuntu/datos-prueba/SG04_Itau_LogsInformes_ssl__37_160413122345.log | |
| pos_file /var/log/td-agent/tmp/access.log.pos | |
| tag input | |
| format none | |
| read_from_head true | |
| </source> | |
| #assign sslyes tag if the log contains the string "ssl", otherwise assign sslno | |
| <match input> | |
| @type rewrite_tag_filter | |
| capitalize_regex_backreference no | |
| rewriterule1 message ssl sslyes | |
| rewriterule2 message ^((?!ssl).)*$ sslno | |
| </match> | |
| <match sslyes sslno> | |
| @type amqp | |
| host xxxxxx | |
| port 5672 | |
| user xxxxx | |
| password xxxxxx | |
| vhost / | |
| exchange xxxxxx | |
| exchange_type topic | |
| exchange_durable true | |
| payload_only true | |
| content_type application/octet-stream | |
| </match> |