From 6600bb2b859e38b7686ef52b05841a1c28e5bcda Mon Sep 17 00:00:00 2001 From: Eric Fontana Date: Wed, 29 Apr 2015 10:58:13 -0400 Subject: [PATCH] Added type parameter for Log/Tail inputs --- TimberWinR/Inputs/InputListener.cs | 5 +++++ TimberWinR/Inputs/LogsListener.cs | 3 +++ TimberWinR/Inputs/TailFileListener.cs | 3 +++ TimberWinR/Parser.cs | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/TimberWinR/Inputs/InputListener.cs b/TimberWinR/Inputs/InputListener.cs index c89abff..621b06a 100644 --- a/TimberWinR/Inputs/InputListener.cs +++ b/TimberWinR/Inputs/InputListener.cs @@ -44,6 +44,11 @@ namespace TimberWinR.Inputs .ToString(); } + public void SetTypeName(string newType) + { + _typeName = newType; + } + public bool HaveSeenFile(string fileName) { return Files.Contains(fileName); diff --git a/TimberWinR/Inputs/LogsListener.cs b/TimberWinR/Inputs/LogsListener.cs index d1372f0..204c44a 100644 --- a/TimberWinR/Inputs/LogsListener.cs +++ b/TimberWinR/Inputs/LogsListener.cs @@ -53,6 +53,9 @@ namespace TimberWinR.Inputs if (_codecArguments != null && _codecArguments.Type == CodecArguments.CodecType.multiline) _codec = new Multiline(_codecArguments); + if (!string.IsNullOrEmpty(arguments.Type)) + SetTypeName(arguments.Type); + _receivedMessages = 0; _arguments = arguments; _pollingIntervalInSeconds = arguments.Interval; diff --git a/TimberWinR/Inputs/TailFileListener.cs b/TimberWinR/Inputs/TailFileListener.cs index 2b7748a..562a4d1 100644 --- a/TimberWinR/Inputs/TailFileListener.cs +++ b/TimberWinR/Inputs/TailFileListener.cs @@ -48,6 +48,9 @@ namespace TimberWinR.Inputs if (_codecArguments != null && _codecArguments.Type == CodecArguments.CodecType.multiline) _codec = new Multiline(_codecArguments); + if (!string.IsNullOrEmpty(arguments.Type)) + SetTypeName(arguments.Type); + _receivedMessages = 0; _arguments = arguments; _pollingIntervalInSeconds = arguments.Interval; diff --git a/TimberWinR/Parser.cs b/TimberWinR/Parser.cs index 324f709..9ab9d12 100644 --- a/TimberWinR/Parser.cs +++ b/TimberWinR/Parser.cs @@ -333,6 +333,8 @@ namespace TimberWinR.Parser public class TailFileArguments : IValidateSchema { + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } [JsonProperty(PropertyName = "location")] public string Location { get; set; } [JsonProperty(PropertyName = "recurse")] @@ -363,6 +365,8 @@ namespace TimberWinR.Parser public class LogParameters : IValidateSchema { + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } [JsonProperty(PropertyName = "location")] public string Location { get; set; } [JsonProperty(PropertyName = "iCodepage")]