Added Validate method

Added tests to validate the configuration.
This commit is contained in:
Eric Fontana
2014-07-28 10:55:17 -04:00
parent 3202c19b7e
commit 65de7cbc93
17 changed files with 623 additions and 235 deletions

View File

@@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using TimberWinR.Outputs;
@@ -22,7 +23,11 @@ namespace TimberWinR.ServiceHost
{
Arguments arguments = new Arguments();
var text = "Nov 21 17:27:53";
var pattern = "MMM dd HH:mm:ss";
var match = Regex.Match(text, pattern);
Type x = Type.GetType("string");
Type x1 = Type.GetType("System.string");
@@ -95,8 +100,9 @@ namespace TimberWinR.ServiceHost
/// </summary>
private void RunService()
{
TimberWinR.Manager manager = new TimberWinR.Manager(_args.ConfigFile, _args.JsonFile);
TimberWinR.Manager manager = new TimberWinR.Manager(_args.ConfigFile, _args.JsonFile, _cancellationToken);
#if false
var outputRedis = new RedisOutput(manager, new string[] { "logaggregator.vistaprint.svc" }, _cancellationToken);
_nlogListener = new TcpInputListener(_cancellationToken, 5140);
@@ -119,6 +125,7 @@ namespace TimberWinR.ServiceHost
var elistner = new TailFileInputListener(logConfig, _cancellationToken);
outputRedis.Connect(elistner);
}
#endif
}
}
}

View File

@@ -1,76 +1,112 @@
{
"TimberWinR":{
"Inputs":{
"WindowsEvents":[
{
"source":"System,Application",
"binaryFormat":"PRINT",
"resolveSIDS":true
{
"TimberWinR": {
"Inputs": {
"WindowsEvents": [
{
"source": "System,Application",
"binaryFormat": "PRINT",
"resolveSIDS": true
}
],
"Tcp": [
{
"port": "5140"
}
],
"Logs": [
{
"name": "Syslogs1",
"location": "C:\\Logs1\\*.log"
}
],
"IISW3CLogs": [
{
"name": "Default site",
"location": "c:\\inetpub\\logs\\LogFiles\\W3SVC1\\*"
}
]
},
"Outputs": {
"Redis": [
{
"host": [
"logaggregator.vistaprint.svc"
]
}
]
},
"Filters": [
{
"grok": {
"condition": "[type] == \"Win32-FileLog\"",
"match": [
"Text",
""
],
"add_field": [
"host",
"%{ComputerName}"
]
}
},
{
"grok": {
"condition": "[type] == \"Win32-Eventlog\"",
"match": [
"Message",
""
],
"remove_field": [
"ComputerName"
]
}
},
{
"grok": {
"match": [
"message",
"%{SYSLOGLINE}"
],
"add_tag": [
"rn_%{Index}",
"bar"
],
"add_field": [
"foo_%{logsource}",
"Hello dude from %{ComputerName}"
]
}
},
{
"grok": {
"match": [
"Text",
"%{SYSLOGLINE}"
],
"add_tag": [
"rn_%{RecordNumber}",
"bar"
]
}
},
{
"mutate": {
"rename": [
"host", "Host",
"message","Message",
"SID", "Username"
]
}
},
{
"date": {
"match": [
"timestamp",
"MMM d HH:mm:sss",
"MMM dd HH:mm:ss"
]
}
}
],
"Logs":[
{
"name":"Syslogs1",
"location":"C:\\Logs1\\*.log"
}
],
"IISW3CLogs":[
{
"name":"Default site",
"location":"c:\\inetpub\\logs\\LogFiles\\W3SVC1\\*"
}
]
},
"Filters":[
{
"grok":{
"condition": "[type] == \"Win32-FileLog\"",
"match":[
"Text",
""
],
"add_field":[
"host",
"%{ComputerName}"
]
}
},
{
"grok":{
"match":[
"message",
"%{SYSLOGLINE}"
],
"add_tag":[
"rn_%{Index}",
"bar"
],
"add_field":[
"foo_%{logsource}",
"Hello dude from %{ComputerName}"
]
}
},
{
"grok":{
"match":[
"Text",
"%{SYSLOGLINE}"
],
"add_tag":[
"rn_%{RecordNumber}",
"bar"
]
}
},
{
"mutate":{
"rename":[
"message",
"Message"
]
}
}
]
}
}
]
}
}