Skip to content

Commit

Permalink
Added monthly mapper
Browse files Browse the repository at this point in the history
Added owners and tags in mappers
  • Loading branch information
mrmx committed Jan 20, 2011
1 parent 773666f commit 9e96d05
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ function () {
k.ida = this._ida;//EVENT_ACTION
k.idk = this._idk;//EVENT_TARGET_TYPE
k.idt = this._idt;//EVENT_TARGET
k.own = this.own || [];//EVENT_TARGET_OWNERS
k.tags = this.tags|| [];//EVENT_TARGET_TAGS
var metaUnique = "ip";
for (var d in this.days) {
var day = this.days[d];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ function () {
k.ida = this._ida;//EVENT_ACTION
k.idk = this._idk;//EVENT_TARGET_TYPE
k.idt = this._idt;//EVENT_TARGET
k.own = this.own || [];//EVENT_TARGET_OWNERS
k.tags = this.tags|| [];//EVENT_TARGET_TAGS
var metaUnique = "ip";
for (var d in this.days) {
var day = this.days[d];
Expand Down
33 changes: 33 additions & 0 deletions src/main/resources/org/mongoste/core/impl/mongodb/targetMapperM.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function () {
var k = {};
k.idc = this._idc;//EVENT_CLIENT_ID
k.ida = this._ida;//EVENT_ACTION
k.idk = this._idk;//EVENT_TARGET_TYPE
k.idt = this._idt;//EVENT_TARGET
k.own = this.own || [];//EVENT_TARGET_OWNERS
k.tags = this.tags|| [];//EVENT_TARGET_TAGS
var metaUnique = "ip";
for (var d in this.days) {
var day = this.days[d];
for (var h in day.hours) {
var hour = day.hours[h];
k.date = new Date();
k.date.setUTCFullYear(this.y);
k.date.setUTCMonth(this.m-1);
k.date.setUTCDate(1);
k.date.setUTCHours(0);
k.date.setUTCMinutes(0);
k.date.setUTCSeconds(0);
k.date.setUTCMilliseconds(0);
for (var meta in hour.meta) {
if(meta == metaUnique) {
var muHour = hour.meta[metaUnique];
for (var mu in muHour) {
emit(k, { count: 0 , unique : 1 });
}
}
}
emit(k, { count : hour.count , unique : 0 });
}
}
}

0 comments on commit 9e96d05

Please sign in to comment.