I am a beginner with Zeek NSM. I have written a script that generates simply notice logs. I don't know where should I place this script or which steps should I follow to generate notice logs or my custom logs
I have already go through the documentation of Zeek and figure out these basic steps.
make a folder in
/nsm/bro/share/bro/site/with your script name.place your script in this folder.
make a new script
main.broand write@load <mycustomScript>.broin it.Than write your folder name (in which you place your script) in
loaded_scripts.bro.Than run the following commands...
i. broctl stop
ii. broctl check
iii. broctl deploy
iv. broctl start
You will find the logs in the same folder (in which we place our script). but after doing all these steps, there are still no logs in that folder.
....................................... basic script for generating notice logs: .......................................
@load base/frameworks/notice
export {
redef enum Notice::Type += {
Test_Notice,
};
event bro_init()
{
NOTICE([$note=Test_Notice, $msg=fmt("Testing the Notice Framework")]);
}
Kindly tell me is this the write sequence of commands to run a custom script? or there is something wrong? or there some additional task required to run the script and generate notice logs?
I found these steps correct.
/opt/bro/share/bro/site/local.broYou can add custom scripts in
/opt/bro/share/bro/policy/and then reference the scripts in/opt/bro/share/bro/site/local.bro. Below is an example how to do so:Create a new directory under
/opt/bro/share/bro/policy/. sudo mkdir/opt/bro/share/bro/policy/custom-scriptsAdd your custom script(s) and
__load__.broto this directory.Modify
__load__.broto reference the scripts in the custom-scripts directory:Edit
/opt/bro/share/bro/site/local.broso that it will load the new scripts in/opt/bro/share/bro/policy/custom-scripts, by adding@load custom-scriptsat the bottom of the file and saving the file.Restart Bro.
sudo so-bro-restartCheck
/nsm/bro/logs/current/loaded_scripts.logto see if your custom script(s) has/have been loaded.Check
/nsm/bro/logs/current/reporter.logfor clues if your custom script(s) is/are not working as desired.To check and see if a Bro script has fired a Notice, go to Kibana and check the Bro Notices dashboard. Alternatively, you can check for entries in
/nsm/bro/logs/current/notice.log.