Hi,
I am trying to filter out events if it contains either source_type=\”APP/PROC/WEB\”
or source_type=APP
in the event.
Can someone please help me on this?
Thanks
Hi,
I am trying to filter out events if it contains either source_type=\”APP/PROC/WEB\”
or source_type=APP
in the event.
Can someone please help me on this?
Thanks
If I understand the question correctly then
if [source_type] in [ 'APP', '"APP/PROC/WEB"' ] { drop {} }
Hi,
But source_type is not a field. Basically, I am trying to search for the entire strings source_type=\”APP/PROC/WEB\”
or source_type=APP
in [message] field.
Thanks for clarifying
if [message] =~ /source_type="APP\/PROC\/WEB"|source_type=APP/ ...
Thanks for the answer. Can you please say if I have to use escape character \ for double quotes and forward slashes. Please let me know if following is correct.
if [message] =~ /source_type=\"APP\/PROC\/WEB\"|source_type=APP/{
drop{}
}
Yes for forward slashes, because the right hand side of =~ is a regexp that starts and ends with a forward slash. No for double quotes. If it were a string starting and ending with double quotes rather than a regexp it would be the other way around.
Thanks Badger. It's working perfectly fine with what I have mentioned above. But if I use another if condition, it's not working,
if [message] =~ /source_type=\"APP\/PROC\/WEB\"|source_type=APP/{
grok{...}
}
if [message] =~ /event_type=ContainerMetric/{
grok{...}
}
else{
drop{}
}
Please say what I am doing wrong.
Any message that matches the first if will be dropped if it does not match the second if. Is that what you want? Or did you mean to do if - else if - else?
You do not say what you mean by "not working". What does the message look like (send it to "output { stdout { codec => rubydebug } }" or paste an event from the JSON tab in Kibana. And what do want to have happen? What defines "working"?
I am looking something like if the event has to be checked with two if conditions else it should be dropped. In my case the moment I remove else statement, I could see events related to 2 conditions in Elasticsearch but when I use else statement, I don't see any messages in Elasticsearch.(Input is from syslog server which continuously flow through udp input plugin )
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.