private ElasticClient MakeElasticSearchClient(ElasticSearchSettings settings)
        {
            var node         = settings.GetElasticSearchUri();
            var connSettings = new ConnectionSettings(node);

            connSettings.DefaultIndex("fabric-databus");
            return(new ElasticClient(connSettings));
        }
        public static ILogger CreateLogger(LoggingLevelSwitch levelSwitch, ElasticSearchSettings elasticSearchSettings,
                                           string clientName, string applicationName)
        {
            var logPrefix   = $"logstash-{clientName}-{applicationName}";
            var sinkOptions = new ElasticsearchSinkOptions(elasticSearchSettings.GetElasticSearchUri())
            {
                IndexFormat        = logPrefix + "-{0:yyyy.MM.dd}",
                BufferBaseFilename = elasticSearchSettings.BufferBaseFilename
            };

            var loggerConfiguration = new LoggerConfiguration()
                                      .MinimumLevel.ControlledBy(levelSwitch)
                                      .Enrich.FromLogContext()
                                      .WriteTo.ColoredConsole()
                                      .WriteTo.Elasticsearch(sinkOptions);

            return(loggerConfiguration.CreateLogger());
        }
 public void GetElasticSearchUri_ValidSettings_CreatesUriSuccessfully(ElasticSearchSettings settings, Uri expectedUri)
 {
     Assert.Equal(expectedUri, settings.GetElasticSearchUri());
 }
 public void GetElasticSearchUri_InvalidSettings_Throws(ElasticSearchSettings elasticSearchSettings)
 {
     Assert.Throws <FabricConfigurationException>(() => elasticSearchSettings.GetElasticSearchUri());
 }