I've started playing with NXlog and have found strange behaviour.

This is my configuration:


<Input b-logs>
    Module      im_file

    File "d:\\Temp\\Logs\\test.txt"
    SavePos TRUE
    InputType LineBased

    Exec if ( $raw_event =~ /^#/ )    \
    {    \
        $raw_event="ok";    \
    }    \
    else    \
    {    \
        $raw_event="bad";    \

<Output b-logs-out>
    Module      om_tcp
    Port        8888

<Route 1>
    Path        b-logs => b-logs-out


I wrote simple python server that listens on TCP port 8888 on machine
What I want to achieve is to display "OK" when line in my test log file, begins with "#" and "BAD" when it is not.

It works at the beginning. Output looks like following example:


Then I'm trying to change character "#" to any other and it stop working. Then I revert changes, put "#" into nxlog.conf again (restart Windows service) and instead of BAD or OK messages, NXLog sends entire line from log file.

I'm getting following results:
#Comment at line4

I can't find reason of this behaviour. 

Could you please give me any hint what may be the reason?
My exampe of configuration is not useful, but I just want to understand how nxlog works to be able to use it to more sophisticated tasks in future.

AskedSeptember 27, 2015 - 8:36am

Answer (1)

The behaviour you saw is probably caused by the nxlog.conf not being saved properly or due to syntax errors.

AnsweredSeptember 28, 2015 - 10:11am