Jan, + re-adding the bro mailing list because email is hard and I accidentally removed it - and in case there’s a bug impacting this script in v 2.5,
I tested this script on my physical security onion box, as well a security onion VM and a CentOS VM both with fresh installs of Bro 2.5. I tested with live network traffic and with a pcap and consistently get different results in my JSON log dir every time I run bro against the pcap.
When I run bro against a pcap, I get the following error:
“expression error in /opt/bro/share/bro/test/./add-json.bro, line 34: field value missing [Log::filter$path]”
It looks like that line refers back to the json path. I have the json path defined as: const path_json = “/nsm/bro/logs/json/” &redef; - is this the correct way to define the log path?
Here’s some examples of the inconsistencies I see (this is reproduceable on all three systems). I’ll run the same pcap through Bro twice and we’ll get a different number of JSON logs, and different entries in the files - but ASCII logs always turn out the same.
root@sensor:/home/sensor/test# /opt/bro/bin/bro -r test.pcap /opt/bro/share/bro/site/local.bro
expression error in /opt/bro/share/bro/test/./add-json.bro, line 34: field value missing [Log::filter$path]
root@sensor:/home/sensor/test# ls
capture_loss.log dhcp.log files.log loaded_scripts.log packet_filter.log ssl.log test.pcap weird.log
conn.log dns.log http.log notice.log reporter.log stats.log tunnel.log x509.log
root@sensor:/home/sensor/test# ls | wc -l
16
root@sensor:/home/sensor/test# cat conn.log | wc -l
1631
root@sensor:/home/sensor/test# ls /nsm/bro/logs/json/
dhcp-json.log tunnel-json.log x509-json.log
root@sensor:/home/sensor/test# ls /nsm/bro/logs/json/ | wc -l
3
As you can see there was no JSON conn log generated - so i’ll compare the dhcp logs:
root@sensor:/home/sensor/test# cat dhcp.log | wc -l
11
root@sensor:/home/sensor/test# cat /nsm/bro/logs/json/dhcp-json.log | wc -l
2
Some of the lines (8) in the ASCII file are headers so this log only missed one entry. It still missed logging all 1631 connections in the pcap to conn.log. I’ll clear out the logs now and try again, and we’ll get a different number types of json logs created.
root@sensor:/home/sensor/test# rm .log
root@sensor:/home/sensor/test# rm /nsm/bro/logs/json/
root@sensor:/home/sensor/test# /opt/bro/bin/bro -r test.pcap /opt/bro/share/bro/site/local.bro
expression error in /opt/bro/share/bro/test/./add-json.bro, line 34: field value missing [Log::filter$path]
root@sensor:/home/sensor/test# ls
capture_loss.log dhcp.log files.log loaded_scripts.log packet_filter.log ssl.log test.pcap weird.log
conn.log dns.log http.log notice.log reporter.log stats.log tunnel.log x509.log
root@sensor:/home/sensor/test# ls | wc -l
16
root@sensor:/home/sensor/test# cat conn.log | wc -l
1631
root@sensor:/home/sensor/test# ls /nsm/bro/logs/json/
capture_loss-json.log files-json.log packet_filter-json.log weird-json.log
conn-json.log loaded_scripts-json.log reporter-json.log x509-json.log
dhcp-json.log notice-json.log tunnel-json.log
root@sensor:/home/sensor/test# ls /nsm/bro/logs/json/ | wc -l
11
root@sensor:/home/sensor/test# cat /nsm/bro/logs/json/conn-json.log | wc -l
1622
This time it logged all the connections, but it failed to even create http, ssl, stats, or dns json logs.
This script is exactly the functionality I need, I just can’t seem to get it working correctly. I don’t begin to understand why I get different results every time I run the same pcap through Bro.
Thanks!
James Gordon