I'm using winlogbeats version 7.12 and it works great but I have a question.
In my windows log in message field I have an XML. What I would like to do is first check if in that XML in specific field there is a specified text and if yes then only store a subset of those XML fields.
What I do right now is that I'm using processor drop_event with condition: when -> not -> contains -> message: myStringToSearchFor
And then I have a processor script
sth like:
function process(event) {
var re = /<ResponseStatus>\w+<\/ResponseStatus>/;
var str = event.Get("message");
var myMatch = str.match(re);
if(myMatch){
event.Put("status", myMatch[0]);
}
event.Delete("message");
}
It is only an example with only one field (ResponseStatus) from my xml message extracted, in the future I would like to extract like 5-10 fields from it.
Still this code works quite well, but I'm not fully convinced that it will perform super fast.
I found decode_xml processor but when I put there configuration from documentation it didn't work with informatiion: parameter fields is missing.
- decode_xml:
fields: message
target_field: xml
ignore_missing: true
ignore_failure: true
So question is: do I use decode_xml in an inccorect way? If it would work would it be faster?
Using the processor would surely be more performant, especially if you planned on using regex.
Usually I tend to just format the whole message into something that is easier to transform, delete or modify, so if we could get the decode_xml processor to decode the message first it would surely be easier to manage afterwards.
I think what you want to use is field and not fields, for example:
- decode_xml:
field: message
target_field: xml
ignore_missing: true
ignore_failure: true
Also make sure the indentation is correct, and that should resolve it.
Hello @witkacy , seems like this was indeed a bug from our side, and this is being resolved in 7.13 and 7.12.2, unfortunately you will have to wait just a little bit longer, sorry for the inconvenience!
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.