1
answer

Hi,

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

This is my configuration:

[code]

<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";    \
    }

</Input>
 
<Output b-logs-out>
    Module      om_tcp
    Host        192.168.0.8
    Port        8888
</Output>

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

[/code]

I wrote simple python server that listens on TCP port 8888 on machine 192.168.0.8.
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:

OK
OK
BAD
OK
OK

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:
#line1
#Line2
TestLine3
#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