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

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

<Route tst_out>
Path maas => maas_testfile

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'.