void IFactory <ISource> .RegisterFactory(IFactoryCatalog <ISource> catalog) { catalog.RegisterFactory(FileSystemSource, this); catalog.RegisterFactory(ULSSource, this); catalog.RegisterFactory(W3SVCLogSource, this); catalog.RegisterFactory(ExchangeLogSource, this); }
public void RegisterFactory(IFactoryCatalog <ISource> catalog) { catalog.RegisterFactory(WINDOWS_EVENT_LOG_POLLING_SOURCE, this); catalog.RegisterFactory(WINDOWS_EVENT_LOG_SOURCE, this); catalog.RegisterFactory(WINDOWS_PERFORMANCE_COUNTER_SOURCE, this); catalog.RegisterFactory(WINDOWS_ETW_EVENT_SOURCE, this); }
public void RegisterFactory(IFactoryCatalog <IEventSink> catalog) { catalog.RegisterFactory(CLOUD_WATCH_LOG, this); catalog.RegisterFactory(KINESIS_FIREHOSE, this); catalog.RegisterFactory(KINESIS_STREAM, this); catalog.RegisterFactory(CLOUD_WATCH, this); catalog.RegisterFactory(TELEMETRICS, this); }
internal void LoadFactories <T>(IFactoryCatalog <T> catalog, Action <int, int> writeMetrics) { int loaded = 0; int failed = 0; try { var factories = _typeLoader.LoadTypes <IFactory <T> >(); foreach (IFactory <T> factory in factories) { try { factory.RegisterFactory(catalog); loaded++; _logger?.LogInformation("Registered factory {0}.", factory); } catch (Exception ex) { failed++; _logger?.LogError("Failed to register factory {0}: {1}.", factory, ex.ToMinimized()); } } } catch (Exception ex) { failed++; _logger?.LogError("Error discovering IFactory<{0}>: {1}.", typeof(T), ex.ToMinimized()); // If the problem discovering the factory is a missing type then provide more details to make debugging easier. if (ex is System.Reflection.ReflectionTypeLoadException) { _logger?.LogError("Loader exceptions: {0}", string.Join(", ", ((System.Reflection.ReflectionTypeLoadException)ex).LoaderExceptions.Select(exception => exception.ToMinimized()).ToArray())); } } writeMetrics(loaded, failed); }
public Session( string name, IConfiguration config, IMetrics metrics, IServiceProvider services, bool validated) { Name = name; StartTime = DateTime.Now; IsValidated = validated; if (IsDefault && validated) { throw new ArgumentException("The default session cannot be validated"); } _config = config; _metrics = metrics; _services = services; _loggerFactory = services.GetService <ILoggerFactory>(); _parameterStore = services.GetService <IParameterStore>(); _networkStatus = new NetworkStatus(services.GetService <INetworkStatusProvider>()); _logger = _loggerFactory.CreateLogger(DisplayName); _logger.LogDebug("Configuration is validated: {0}", IsValidated); _bookmarkManager = new FileBookmarkManager(Utility.GetBookmarkDirectory(name), _loggerFactory.CreateLogger($"{DisplayName}:{nameof(IBookmarkManager)}"), services.GetService <IAppDataFileProvider>()); var factoryCatalogs = services.GetService <FactoryCatalogs>(); _sourceFactoryCatalog = factoryCatalogs.SourceFactoryCatalog; _sinkFactoryCatalog = factoryCatalogs.SinkFactoryCatalog; _credentialProviderFactoryCatalog = factoryCatalogs.CredentialProviderFactoryCatalog; _genericPluginFactoryCatalog = factoryCatalogs.GenericPluginFactoryCatalog; _pipeFactoryCatalog = factoryCatalogs.PipeFactoryCatalog; _recordParserCatalog = factoryCatalogs.RecordParserCatalog; }
void IFactory <ISource> .RegisterFactory(IFactoryCatalog <ISource> catalog) { catalog.RegisterFactory("MockSource", this); }
public void RegisterFactory(IFactoryCatalog <ISource> catalog) { catalog.RegisterFactory(ULSSOURCE, this); }
public ReadOnlyFactoryCatalog(IFactoryCatalog <T> factoryCatalog) { Guard.ArgumentNotNull(factoryCatalog, "factoryCatalog"); _factoryCatalog = factoryCatalog; }
public void RegisterFactory(IFactoryCatalog <IPipe> catalog) { catalog.RegisterFactory(REGEX_FILTER_PIPE, this); catalog.RegisterFactory(EMF_PIPE, this); }
/// <summary> /// Call by the infrastructure to register the name of the factory into the catalog /// </summary> /// <param name="catalog">Catalog</param> public void RegisterFactory(IFactoryCatalog <IRecordParser> catalog) { catalog.RegisterFactory(SINGLE_LINE_JSON2, this); }
/// <summary> /// Create an instance o the DirectorySource /// </summary> /// <param name="entry">Name of the source</param> /// <param name="context">Plug-in Context</param> /// <returns></returns> public virtual ISource CreateInstance(string entry, IPlugInContext context) { IConfiguration config = context.Configuration; ILogger logger = context.Logger; switch (entry.ToLower()) { case "directorysource": string recordParser = (config["RecordParser"] ?? string.Empty).ToLower(); string timetampFormat = config["TimestampFormat"]; string timestampField = config["TimestampField"]; DateTimeKind timeZoneKind = Utility.ParseTimeZoneKind(config["TimeZoneKind"]); string removeUnmatchedConfig = config["RemoveUnmatched"]; bool removeUnmatched = false; if (!string.IsNullOrWhiteSpace(removeUnmatchedConfig)) { removeUnmatched = bool.Parse(removeUnmatchedConfig); } string extractionPattern = config["ExtractionPattern"]; string extractionRegexOptions = config["ExtractionRegexOptions"]; switch (recordParser) { case "singleline": return(CreateEventSource(context, new SingeLineRecordParser())); case "regex": string pattern = config["Pattern"]; return(CreateEventSource(context, new RegexRecordParser(pattern, timetampFormat, logger, extractionPattern, extractionRegexOptions, timeZoneKind, new RegexRecordParserOptions { RemoveUnmatchedRecord = removeUnmatched }))); case "timestamp": return(CreateEventSource(context, new TimeStampRecordParser(timetampFormat, logger, extractionPattern, extractionRegexOptions, timeZoneKind, new RegexRecordParserOptions { RemoveUnmatchedRecord = removeUnmatched }))); case "syslog": return(CreateEventSource(context, new SysLogParser(logger, timeZoneKind, new RegexRecordParserOptions { RemoveUnmatchedRecord = removeUnmatched }))); case "delimited": return(CreateEventSourceWithDelimitedLogParser(context, timetampFormat, timeZoneKind)); case "singlelinejson": return(CreateEventSource(context, new SingleLineJsonParser(timestampField, timetampFormat))); default: IFactoryCatalog <IRecordParser> parserFactories = context?.ContextData?[PluginContext.PARSER_FACTORIES] as IFactoryCatalog <IRecordParser>; var parserFactory = parserFactories.GetFactory(recordParser); if (parserFactory == null) { throw new ArgumentException($"Unknown parser {recordParser}"); } else { return(CreateEventSource(context, parserFactory.CreateInstance(recordParser, context))); } } case "w3svclogsource": return(CreateEventSource( context, new W3SVCLogParser(context))); default: throw new ArgumentException($"Source {entry} not recognized."); } }
/// <summary> /// Register factories /// </summary> /// <param name="catalog">Source catalog</param> public virtual void RegisterFactory(IFactoryCatalog <ISource> catalog) { catalog.RegisterFactory("DirectorySource", this); catalog.RegisterFactory("W3SVCLogSource", this); }
public void RegisterFactory(IFactoryCatalog <ISource> catalog) { catalog.RegisterFactory("ExchangeLogSource", this); }
public void RegisterFactory(IFactoryCatalog <ICredentialProvider> catalog) { catalog.RegisterFactory(PROFILE_REFRESHING_AWS_CREDENTIAL_PROVIDER, this); }
public void RegisterFactory(IFactoryCatalog <IEventSink> catalog) { catalog.RegisterFactory(PERFORMANCE_COUNTER, this); }
void IFactory <IEventSink> .RegisterFactory(IFactoryCatalog <IEventSink> catalog) { catalog.RegisterFactory(nameof(MockListSink), this); catalog.RegisterFactory("RateExceeded", this); }
public void RegisterFactory(IFactoryCatalog <IGenericPlugin> catalog) { catalog.RegisterFactory(PACKAGE_UPDATE, this); catalog.RegisterFactory(CONFIG_UPDATE, this); }
public void RegisterFactory(IFactoryCatalog <IGenericPlugin> catalog) { catalog.RegisterFactory(nameof(MockNetworkStatusProvider), this); }