public void TestNonGenericCreateEventSourceWithDelimitedParser() { var config = TestUtility.GetConfig("Sources", "DHCPParsed"); string timestampField = config["TimestampField"]; PluginContext context = new PluginContext(config, null, null); IRecordParser parser = DirectorySourceFactory.CreateDelimitedLogParser(context, timestampField, DateTimeKind.Utc); var source = DirectorySourceFactory.CreateEventSource(context, parser); Assert.NotNull(source); Assert.IsType <DirectorySource <DelimitedLogRecord, DelimitedLogContext> >(source); }
public void TestNonGenericCreateEventSource() { var config = TestUtility.GetConfig("Sources", "JsonLog1"); string timetampFormat = config["TimestampFormat"]; string timestampField = config["TimestampField"]; IRecordParser parser = new SingleLineJsonParser(timestampField, timetampFormat, NullLogger.Instance); PluginContext context = new PluginContext(config, null, null); var source = DirectorySourceFactory.CreateEventSource(context, parser); Assert.NotNull(source); Assert.IsType <DirectorySource <JObject, LogContext> >(source); }
public ISource CreateInstance(string entry, IPlugInContext context) { IConfiguration config = context.Configuration; ILogger logger = context.Logger; switch (entry.ToLower()) { case ULSSOURCE: UlsLogParser ulsParser = new UlsLogParser(); return(DirectorySourceFactory.CreateEventSource( context, ulsParser)); default: throw new ArgumentException($"Source {entry} not recognized."); } }
public ISource CreateInstance(string entry, IPlugInContext context) { IConfiguration config = context.Configuration; ILogger logger = context.Logger; switch (entry.ToLower()) { case "exchangelogsource": ExchangeLogParser exchangeLogParser = new ExchangeLogParser(); exchangeLogParser.TimeStampField = config["TimeStampField"]; return(DirectorySourceFactory.CreateEventSource( context, exchangeLogParser)); default: throw new ArgumentException($"Source {entry} not recognized."); } }