Delay event processing


#1 LukeOrins

Hi everyone! I`m trying to delay an event processing for a second, i.e.: if an event has a description I'll delay the output for a period. I found the sleep method in the Documentation, but it's not working as intended. Below is how my input is configured:

<Input input_file>
    Module            im_file
    File            "%LOGPATH%"
    ReadFromLast            TRUE
    Recursive            FALSE
	
	<Exec>
        if ($raw_event =~ /UPDATE/)
        {
            parse_json();
        }
        else if ($raw_event =~ /DELETE/)
        {
            sleep(2000) # wait 2 seconds before processing this event
            parse_json();
        }
    </Exec>
</Input>

Is is possible to delay/wait for a few seconds before processing an event?

Thank you in advance!

#2 rafDeactivated Nxlog ✓
#1 LukeOrins
Hi everyone! I`m trying to delay an event processing for a second, i.e.: if an event has a description I'll delay the output for a period. I found the sleep method in the Documentation, but it's not working as intended. Below is how my input is configured: <Input input_file> Module im_file File "%LOGPATH%" ReadFromLast TRUE Recursive FALSE <Exec> if ($raw_event =~ /UPDATE/) { parse_json(); } else if ($raw_event =~ /DELETE/) { sleep(2000) # wait 2 seconds before processing this event parse_json(); } </Exec> </Input> Is is possible to delay/wait for a few seconds before processing an event? Thank you in advance!

Hello,

Have you tried the sleep() procedure? It takes a number of microseconds as an argument - I suppose it might help with your task. The docs are here:

https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html#core_proc_sleep

Regards,

Rafal