Log File Monitoring Script

NexOSS Log File Monitoring Script

This document provides an example of how NexOSS users can monitor NexOSS log files to generate customized actions based on NexOSS events.

Every time NexOSS activates a TrafficAnalyzer, QoS or Fraud trigger, the event is logged in the $NexOSS_HOME/LOG/TriggerEvents.log file. The following script may be implemented by the NexOSS user to tail the log file and execute a custom script for every new line. In this example, the external custom script has the name customerScriptOnTriggerEvent.sh, but any name may be used. The NexOSS user must own the script that monitors the NexOSS log file, must own the script that it calls and must have permission to read NexOSS files.

## For each new line in the TriggerEvents.log file
## -F flag is used to follow the file even after the old one is rolled (renamed to have a date stamp)
tail -F $NexOSS_HOME/LOG/TriggerEvents.log | while read line           
do           
 ## Extract group name from TriggerEvents.log file, column number 4
declare group=`echo "$line" | cut -d'|' -f 4`
## Display the group name
echo "Account in the trigger event $group"
## Call the external custom script and pass $group as a parameter
customerScriptOnTriggerEvent.sh $group
done 

The following line is an example command to start the log monitoring script.

nohup ./TriggerEventMonitoringScript.sh &

nohup and & are used to run the script in background and remove dependency on the shell that started the script.