1

I would like to delete the logfile once processing, what I did:

<Extension multiline>
    Module      xm_multiline
    Exec        if $raw_event =~ /^\s*$/ drop();
    HeaderLine  /Debut du job/
</Extension>

<Input in1>
    Module      im_file
    File        '/opt/appl/appli/logs/*.nxlog'
    InputType   multiline
    Exec        $nxlog_message = $raw_event;
    Exec        $nxlog_tags = "appli";
    Exec        $nxlog_hostname = hostname();
    Exec        $nxlog_filename = file_name();
    Exec        to_json();
</Input>

<Extension exec_out>
    Module      xm_exec
</Extension>


<Output fileout1>
     Module      om_file
     File        "/tmp/test.log"
     Exec        exec_async("/bin/rm" + $nxlog_filename);
</Output>

For now, nothing happened… I'm looking forward for idea.

Thx for help :)

1 Answer 1

1

I think the issue is that exec_async() should not receive the arguments concatenated to the command, i.e. you need this instead:

Exec        exec_async("/bin/rm", $nxlog_filename);

I'd recommend using the built in file_remove() instead of invoking /bin/rm.

1
  • Thx, file_remove() do the trick :)
    – Tr4sK
    Dec 17, 2015 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .