Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Add the ability to ignore certain events #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports.watch = function (region) {

var ignored_users = process.env.IGNORED_USERNAMES ? process.env.IGNORED_USERNAMES.split(',') : [];
var ignored_ua = process.env.IGNORED_UA ? process.env.IGNORED_UA.split(',') : [];
var ignored_events = process.env.IGNORED_EVENTS ? process.env.IGNORED_EVENTS.split(',') : [];

function find_events (params) {
log('query with', params);
Expand All @@ -41,7 +42,8 @@ module.exports.watch = function (region) {
}).filter(function (event) {
return !sent.get(event.EventId) &&
!~ignored_users.indexOf(event.Username) &&
!~ignored_ua.indexOf(event.CloudTrailEvent.userAgent);
!~ignored_ua.indexOf(event.CloudTrailEvent.userAgent) &&
!~ignored_events.indexOf(event.EventName);
});

events = _.sortBy(events, 'EventTime');
Expand Down Expand Up @@ -78,4 +80,4 @@ module.exports.watch = function (region) {
MaxResults: 20,
StartTime: moment().add(-20, 'm').toDate()
});
};
};