Log tracking module with node
Log file tracker using in node. Installing and using easily as npm module. npm
$ npm install oranch
To create oranch object, you should give some options as below. Default is cron scheduling.
schedule: Oranch read logfile at fixed interval decided by this parameter. Written in crontab format.
logfile: Oranch read this file.
task: When log matching is induced, this task will be called.
jobType: If you want to use watch file API, set
watchor with cron scheduler set
match: Log matching is conditioned by this regular expression.
endMatch: With this options you can finish job when this tag matches
offset: If you want to off default
alreadyfiles, oranch starts reading as you like by this offset.
onComplete: When oranch stops, this function will be called.
These are all required parameters.
If your tracking is unfrequent, you should use watchFile API in node. watchFile API calls your task funcion in the case of updating logfile. So it will be more efficient unfrequent case.
In order to start tracking log, please call
When you want to stop oranch log tracking, call
var Oranch = require'oranch'Oranch;var options ='schedule' : '* * * * * *''logfile' : '/path/to/somelogfile.log''match' : /WARN/'jobType' : 'cron'// Write down what you want when WARN log is induced.// Write down what you want when Oranch stops;var oranch = options;oranchstart;