winit-activity-logs
v1.0.5
Published
WinIt logs parser
Downloads
10
Readme
Winit logs parser
Simple package for parsing Papertrail logs
Using it
installation :
npm i winit-activity-logs --save
initialization:
let LogApi = require('winit-activity-logs');
let logApi = new LogApi({
token: 'Papertrail access key',
period: 7 // number, days count, by default 7
});
set any scheduler to download logs archives for period set on initialization:
agenda.every('59 23 * * 7', 'getLastLogFile', null, jobOptions);
/*
..........
*/
agenda.define("getLastLogFile", function(request, done) {
logApi.getLogs().then(function () {
done();
}).catch(function (err) {
done(err);
});
});
search for any query in log files
logApi.search('QUERY').then(function (entries) {
/*
entries = [
{
id: 808173503177244676,
date: '2017-06-05T00:00:16',
message: 'SOME STRING'
},
....
]
*/
});