Continued work towards IIS
This commit is contained in:
@@ -69,9 +69,7 @@ namespace TimberWinR.ServiceHost
|
||||
_args = args;
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
_cancellationToken = _cancellationTokenSource.Token;
|
||||
_serviceTask = new Task(RunService, _cancellationToken);
|
||||
|
||||
|
||||
_serviceTask = new Task(RunService, _cancellationToken);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
@@ -90,19 +88,19 @@ namespace TimberWinR.ServiceHost
|
||||
/// </summary>
|
||||
private void RunService()
|
||||
{
|
||||
var config = new Configuration(_args.ConfigFile);
|
||||
TimberWinR.Manager manager = new TimberWinR.Manager(_args.ConfigFile);
|
||||
|
||||
var outputRedis = new RedisOutput(new string[] { "tstlexiceapp006.vistaprint.svc", "tstlexiceapp007.vistaprint.svc" }, _cancellationToken);
|
||||
_nlogListener = new TcpInputListener(_cancellationToken, 5140);
|
||||
outputRedis.Connect(_nlogListener);
|
||||
|
||||
foreach (Configuration.WindowsEvents eventConfig in config.Events)
|
||||
foreach (Configuration.WindowsEvents eventConfig in manager.Config.Events)
|
||||
{
|
||||
var elistner = new WindowsEvtInputListener(eventConfig, _cancellationToken);
|
||||
outputRedis.Connect(elistner);
|
||||
}
|
||||
|
||||
TimberWinR.Manager manager = new TimberWinR.Manager(_args.ConfigFile);
|
||||
|
||||
|
||||
//while (!_cancellationTokenSource.IsCancellationRequested)
|
||||
//{
|
||||
// System.Threading.Thread.Sleep(1000);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<TimberWinR>
|
||||
<Inputs>
|
||||
<WindowsEvents>
|
||||
<Events source="System,Application" binaryFormat="PRINT" fullText="crap" />
|
||||
<Events source="System,Application,Security" binaryFormat="PRINT" />
|
||||
</WindowsEvents>
|
||||
<Logs>
|
||||
<Log name="First Set" location="C:\Logs1\*.log" />
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using NLog;
|
||||
using TimberWinR.Inputs;
|
||||
namespace TimberWinR
|
||||
{
|
||||
@@ -33,7 +34,16 @@ namespace TimberWinR
|
||||
|
||||
public Configuration(string xmlConfFile)
|
||||
{
|
||||
parseXMLConf(xmlConfFile);
|
||||
try
|
||||
{
|
||||
parseXMLConf(xmlConfFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.GetCurrentClassLogger().Error(ex);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static List<FieldDefinition> parseFields_Events(IEnumerable<XElement> xml_fields)
|
||||
@@ -479,10 +489,7 @@ namespace TimberWinR
|
||||
|
||||
IISLogs iis = new IISLogs(name, location, fields, args);
|
||||
_iislogs.Add(iis);
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("end");
|
||||
}
|
||||
}
|
||||
|
||||
public class WindowsEvents
|
||||
|
||||
@@ -44,10 +44,15 @@ namespace TimberWinR.Inputs
|
||||
// Instantiate the Event Log Input Format object
|
||||
var iFmt = new EventLogInputFormat()
|
||||
{
|
||||
direction = _arguments.Direction,
|
||||
binaryFormat = _arguments.BinaryFormat,
|
||||
iCheckpoint = fileName,
|
||||
direction = _arguments.Direction,
|
||||
formatMsg = _arguments.FormatMsg,
|
||||
fullEventCode = _arguments.FullEventCode,
|
||||
fullText = _arguments.FullText,
|
||||
msgErrorMode = _arguments.MsgErrorMode,
|
||||
stringsSep = _arguments.StringsSep,
|
||||
resolveSIDs = _arguments.ResolveSIDS,
|
||||
iCheckpoint = fileName,
|
||||
};
|
||||
|
||||
// Create the query
|
||||
|
||||
@@ -14,13 +14,10 @@ namespace TimberWinR
|
||||
/// </summary>
|
||||
public class Manager
|
||||
{
|
||||
Configuration Config { get; set; }
|
||||
public Configuration Config { get; set; }
|
||||
|
||||
public Manager(string configurationFile=null)
|
||||
{
|
||||
// Read the Configuration file
|
||||
Config = new Configuration(configurationFile);
|
||||
|
||||
{
|
||||
var loggingConfiguration = new LoggingConfiguration();
|
||||
|
||||
// Create our default targets
|
||||
@@ -37,7 +34,10 @@ namespace TimberWinR
|
||||
LogManager.Configuration = loggingConfiguration;
|
||||
LogManager.EnableLogging();
|
||||
|
||||
LogManager.GetCurrentClassLogger().Info("Initialized");
|
||||
LogManager.GetCurrentClassLogger().Info("Initialized");
|
||||
|
||||
// Read the Configuration file
|
||||
Config = new Configuration(configurationFile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user