New to nxlog i don't even know where to search for that kind of needs...

SFB is a Microsoft UC client with several hundred Mo logs per day. I need to extract only a few information between strings for each PC.
How can i achieve that ??

For Exp i need to extract this spécific info between those delimiters : <v3:Density>0.004195841</v3:Density>

Thanks for any help.

AskedJune 11, 2018 - 3:32pm

Answer (1)

Regex is your friend! There are many places in the manual that show this kind of work. Here for instance.

In this example we are rewriting the entire parsed $message with the results of what is between those tags. Capture groups are there so we can address them directly and only take what we want.

    if $raw_event =~ /(\<v3\:Density\>)(.*)(\<\/v3\:Density\>)/
        $message = $2;

Comments (2)

  • RGO's picture


    Thanks a lot, I'll try this.

    Another goal is to have the output in Json format, but don't know how the to_json() function works.
    => If i just export the result of the regex through it, will it be OK ??

    Thanks again

  • Zhengshi's picture

    Please see the following link. There are also several examples in the User Guide.