Zeek (Bro) rename log according to input file

361 views Asked by At

I'm running zeek/bro on individual pcap files with the command line parameter -r inputfile.pcap. How can I access the file name of this input file in a bro script? I would like to rename the conn.log to inputfile_conn.log.

1

There are 1 answers

1
Gil Hamilton On

As far as I can tell, that's not possible. For one thing, it appears that you can give multiple pcap files to zeek on the command line, and they are all opened in parallel. In that case, there would be no correct answer to "what pcap is being processed?" In any case, I can't find any way that would be exposed to scripts.

I would recommend you work around it by wrapping zeek with a script that places the name of the file into an environment variable. Then within the script, you can use getenv to obtain the value stored in the environment variable.