after I have tried many times, I found out that it would drop not only the first line start with "# Time",and also the whole message that the grok pattern matched next!!!
eeeeee.......really thans for your reply
cos this is mysql-slow.log.so I have to use the multiline codec .
now ,how can I drop this line: ....."# Time: 161214 1:31:33"
I tried this:
grok {
match => { "message" => "^# Time:\s+\d{6}\s+\d{1,2}:\d{2}:\d{2}\n" }
add_tag => [ "time" ]
tag_on_failure =>
}
if "time" in [tags] {
drop {}
}
but it didn't work. and I tried another way like this:
if "_grokparsefailure" in [tags] {
drop {}
}
this did work,but I think it is not a proper way to drop this message.
it will ignore these two messages "# Time: 161214 10:21:28 " "# administrator command: Prepare;" only if they are not at the first line.
now I am considering the situation when the log rotate,and one of these two messages comes to the first line.....how to solve this
and really thank you
I still don't understand. If you look for the User@Host line in the multiline pattern and don't care about the Time value, why does it matter where the Time value ends up? Just adjust your grok expression to handle all cases. You can also use a mutate filter's gsub option to remove the Time value regardless of where in the string it occurs.
...........I am just a rookie here. I still don't know how to modify the logstash.conf . Could you give me a template or example...
really really thanks
I bought a book about ELK...wrote by a chinese author.and it didn't help me a lot. so far ,I could only get help from the internet ,especially from this forum,from you...it's a sad story
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.