From 640e18e8c44c9a7ddb68614bb2500919c24e6cfd Mon Sep 17 00:00:00 2001 From: Eric Fontana Date: Mon, 28 Jul 2014 14:10:46 -0400 Subject: [PATCH] Fixed broken unit test --- TimberWinR.ServiceHost/config.json | 6 ++++-- TimberWinR.UnitTests/Configuration.cs | 1 + TimberWinR/Filters/DateFilter.cs | 9 +++++++++ TimberWinR/Parser.cs | 3 +++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/TimberWinR.ServiceHost/config.json b/TimberWinR.ServiceHost/config.json index 302f969..c3aa13d 100644 --- a/TimberWinR.ServiceHost/config.json +++ b/TimberWinR.ServiceHost/config.json @@ -78,10 +78,11 @@ }, { "date": { + "condition": "[type] == \"Win32-IISLog\"", "match": [ "timestamp", "MMM d HH:mm:sss", - "MMM dd HH:mm:ss" + "MMM dd HH:mm:ss" ], "target": "UtcTimestamp", "convertToUTC": true @@ -89,8 +90,9 @@ }, { "mutate": { - "_comment": "Orion Rules", + "_comment": "Orion Rules", "rename": [ + "ComputerName", "Host", "host", "Host", "message","Message", "type","Type", diff --git a/TimberWinR.UnitTests/Configuration.cs b/TimberWinR.UnitTests/Configuration.cs index bc4fb14..1001ba4 100644 --- a/TimberWinR.UnitTests/Configuration.cs +++ b/TimberWinR.UnitTests/Configuration.cs @@ -105,6 +105,7 @@ namespace TimberWinR.UnitTests ""Filters"":[ { ""date"":{ + ""target"": ""timestamp"", ""match"":[ ""timestamp"", ""MMM d HH:mm:sss"", diff --git a/TimberWinR/Filters/DateFilter.cs b/TimberWinR/Filters/DateFilter.cs index 4563fce..b72ca22 100644 --- a/TimberWinR/Filters/DateFilter.cs +++ b/TimberWinR/Filters/DateFilter.cs @@ -16,6 +16,9 @@ namespace TimberWinR.Parser { public override bool Apply(JObject json) { + if (Condition != null && !EvaluateCondition(json, Condition)) + return false; + if (Matches(json)) { ApplyFilter(json); @@ -57,6 +60,12 @@ namespace TimberWinR.Parser { DateTime ts; var exprArray = Match.Skip(1).ToArray(); + var resolver = new RegexGrokResolver(); + for (int i=0; i