1
response

How can I get the filepath from im_file and pass it as variable in the Output.. as you can see i am using Recursive TRUE, want's to know which file from which directory, current message came from

<Input tst>
Module im_file
File "/home/*.log"
Recursive TRUE
</Input>

<Output tst_testfile>
Module om_file
File "/home/user/nxlogtest"
<Exec>
$tst_filepath = ??;
$Message = $raw_event; to_json();
</Exec>
</Output>

<Route tst_out>
Path maas => maas_testfile
</Route>

AskedAugust 19, 2020 - 10:27pm

Answer (1)

Add something like

Exec $WhichFile=file_name();

to your individual im_file Input. No need to add anything to the Output - it will appear as WhichFile in e.g. Graylog in 'Fields'.