6
responses

Hi,
My system creates binary log file whenever some error happens.
So, I would like to send the binary log file to server(also running the nxlog) when the file is created.
The binary log file is created with specific extension name (for example *.binlog) and I want to send the file to server with same filename.
Can I do this with nxlog?

Thanks.

Harry

AskedOctober 22, 2019 - 12:25pm

Answer (1)

Hi!

There's no module that is set to transfer files. You would have to do it with a script in a schedule block, and then moving the source file out of the directory so it is not processed again. Run it with your desired periodicity.

Please see manual section regarding exec()/exec_async and schedule...

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

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

Comments (5)

  • phg98's picture

    Thank you for the comment.

    Is it possible to do something like:
    <Input binfile>
    Module im_file
    File '*.binlog'
    Exec exec('script_to_transfer_the_file_and_move_out_of_dir.script', file_name())
    </Input>

    Thanks in advance.

  • phg98's picture

    Thank you for the reply.

    I tried :
    <Extension fileop>
    Module xm_fileop
    </Extension>

    # Monitor binary files
    <Input binwatchfile>
    Module im_file
    File 'D:\\logs\\*.png'
    <Schedule>
    Every 1 sec
    First 2010-12-17 00:19:06
    Exec log_info("scheduled execution at " + now());
    </Schedule>
    <OnEOF>
    Exec log_info(file_name());
    Exec log_info(" Found");
    # run script here in future.
    Exec file_remove(file_name());
    </OnEOF>
    </Input>

    But it won't start. There's error regarding the 'OnEOF'.
    Is 'OnEOF' only supported in Enterprise version?

    Thanks.

  • phg98's picture

    Thank you for the reply Manuel,

    I think <OnEOF> can solve this problem but sad to hear that community version does not support the option.
    I will make script program to do this.

    Thank you for the kind reply so far.

    Harry.