5
responses

Hi all,

I am new with NXLOG and I have a very basic question to ask you : is it possible to simply copy a file from server A (source file name : c:\osit\log\df_mon.log) to server B (target file name : c:\osit\log15\df_mon.log). I spent already hours on NXLOG config file but I was not able to make it worked because the instruction "File" seeems not to be compatible wit the "om_tcp" output modeule and Host/Port settings.

Thanks a lot in advance, Sophie

AskedMay 21, 2016 - 8:29pm

Answer (1)

It is possible to set up NXLog so that it collects logs from files , transfers it over the network and stores the data in the same structure. The following (untested) configs would do that.

############ Client conf #################
<Extension fileop>
    Module xm_fileop
</Extension>

<Input test_data>
   Module im_file
   File   '/logs/*.log'
   Exec   $Filename = file_basename(file_name());
</Input>

<Output out>
    Module      om_tcp
    Host        10.1.2.3
    Port        1515
    OutputType  Binary
</Output>

<Route client>
    Path   in => out
</Route>

############ Server conf #################

<Input in>
        Module    im_tcp
        Host      0.0.0.0
        Port      1514
        InputType Binary
</Input>

<Output out>
        Module  om_file
        File    '/path/to/logs/' + $Filename
</Output>

<Route server>
    Path   in => out
</Route>

Comments (4)

  • sophie's picture

    Hello,
    thanks a lot for your answer !
    From what you have writen, I understand that NXLOG must be installed on Source and Remote server. Is that true ?
    For the moment, I have installed NXLOG on Source server and Logstash on Remote server. Is that OK or should I also install NXLOG on the Remote server instaed of Logstash ?
    Thanks in advance,
    Sophie

  • adm's picture
    (NXLog)

    The Binary mode is only understood by NXLog. If you are using Logstash you can transfer the data in JSON and set up logstash to process that.

  • sophie's picture

    Hello,

    I have followed your instruction and I have now the expected file on the remote server, thanks for that !
    I have a last question and I hope you can help me with this one : on the remote server, I can not open the file (because it is owned by NXLOG) until I stop the NXLOG service.
    Is there a way to avoid this and to always release the target file ?

    Thanks in advance,
    Cheers,
    Sophie

     

     

  • adm's picture
    (NXLog)

    Some text editors (such as wordpad) need exclusive locking and will refuse to open the log file while NXLog is running and keeps the file opened. Use something that does not need exclusive locking, e.g. notepad.exe.