file_cycle writing to ".1" file


#1 JRausch

Hello,

I'm trying to use file_cycle to clean up old NXLog files.  When I start NXLog I see my log file "Demo.log" created and being written to.  When my schedule executes I see the log file getting renamed to "Demo.log.1" but no new Demo.log file is created and NXLog still continues to write to the "Demo.log.1" file.

I'm not sure if I have something set incorrectly or if there is a bug.  Here's the necessary bits from nxlog.conf:


define NXLOG_DEMO c:\NXlog\Demo.log
<Extension fileop>
   Module      xm_fileop
   <Schedule>
       #Cycle the NXLog files daily and only keep 14 days
       When    @daily
       Exec    file_cycle('%NXLOG_DEMO%', 14);
   </Schedule>   
</Extension>
<Output Demo_out>
    Module      om_file
    file        '%NXLOG_DEMO%'
    CreateDir   TRUE
</Output>

I'm not sure if I have something set incorrectly or if there's a better way to do what I'm trying to accomplish.

Thanks! Jeff

 

#2 adm Nxlog ✓
#1 JRausch
Hello, I'm trying to use file_cycle to clean up old NXLog files.  When I start NXLog I see my log file "Demo.log" created and being written to.  When my schedule executes I see the log file getting renamed to "Demo.log.1" but no new Demo.log file is created and NXLog still continues to write to the "Demo.log.1" file. I'm not sure if I have something set incorrectly or if there is a bug.  Here's the necessary bits from nxlog.conf: define NXLOG_DEMO c:\NXlog\Demo.log <Extension fileop> Module xm_fileop <Schedule> #Cycle the NXLog files daily and only keep 14 days When @daily Exec file_cycle('%NXLOG_DEMO%', 14); </Schedule> </Extension> <Output Demo_out> Module om_file file '%NXLOG_DEMO%' CreateDir TRUE </Output> I'm not sure if I have something set incorrectly or if there's a better way to do what I'm trying to accomplish. Thanks! Jeff  

You need to use reopen().

<Extension fileop>
   Module xm_fileop
</Extension>

<Output Demo_out>
    Module om_file
    file '%NXLOG_DEMO%'
    CreateDir TRUE

    <Schedule>
        #Cycle the NXLog files daily and only keep 14 days
        When @daily
        Exec file_cycle('%NXLOG_DEMO%', 14); Demo_out->reopen();
    </Schedule>
</Output>