diff --git a/TimberWinR/Configuration.cs b/TimberWinR/Configuration.cs index 5f12f39..42037f5 100644 --- a/TimberWinR/Configuration.cs +++ b/TimberWinR/Configuration.cs @@ -118,13 +118,13 @@ namespace TimberWinR if (allInputs == null) throw new TimberWinR.ConfigurationErrors.MissingRequiredTagException(InputBase.TagName); - createInput(allInputs, WindowsEvent.ParentTagName, WindowsEvent.TagName, _events, WindowsEvent.Parse); - createInput(allInputs, TailFileInput.ParentTagName, TailFileInput.TagName, _logs, TailFileInput.Parse); - createInput(allInputs, IISLog.ParentTagName, IISLog.TagName, _iislogs, IISLog.Parse); - createInput(allInputs, IISW3CLog.ParentTagName, IISW3CLog.TagName, _iisw3clogs, IISW3CLog.Parse); + createInputs(allInputs, WindowsEvent.ParentTagName, WindowsEvent.TagName, _events, WindowsEvent.Parse); + createInputs(allInputs, TailFileInput.ParentTagName, TailFileInput.TagName, _logs, TailFileInput.Parse); + createInputs(allInputs, IISLog.ParentTagName, IISLog.TagName, _iislogs, IISLog.Parse); + createInputs(allInputs, IISW3CLog.ParentTagName, IISW3CLog.TagName, _iisw3clogs, IISW3CLog.Parse); } - static void createInput(XElement allInputs, string parentTagName, string tagName, List inputList, Action, XElement> parse) + static void createInputs(XElement allInputs, string parentTagName, string tagName, List inputList, Action, XElement> parse) { IEnumerable inputs = from el in allInputs.Elements(parentTagName).Elements(tagName) diff --git a/TimberWinR/Filters/GrokFilter.cs b/TimberWinR/Filters/GrokFilter.cs index 1fb3036..9a439b2 100644 --- a/TimberWinR/Filters/GrokFilter.cs +++ b/TimberWinR/Filters/GrokFilter.cs @@ -65,30 +65,7 @@ namespace TimberWinR.Filters if (e != null) { - string attributeName = "value"; - string value; - try - { - value = e.Attribute(attributeName).Value; - } - catch - { - throw new TimberWinR.ConfigurationErrors.MissingRequiredAttributeException(e, attributeName); - } - - - if (value == "ON" || value == "true") - { - DropIfMatch = true; - } - else if (value == "OFF" || value == "false") - { - DropIfMatch = false; - } - else - { - throw new TimberWinR.ConfigurationErrors.InvalidAttributeValueException(e.Attribute(attributeName)); - } + DropIfMatch = ParseBoolAttribute(e, "value", false); } } @@ -98,17 +75,7 @@ namespace TimberWinR.Filters { if (e != null) { - string attributeName = "value"; - string value; - try - { - value = e.Attribute(attributeName).Value; - } - catch - { - throw new TimberWinR.ConfigurationErrors.MissingRequiredAttributeException(e, attributeName); - } - RemoveFields.Add(e.Attribute("value").Value); + RemoveFields.Add(ParseStringAttribute(e, "value")); } } }