I use Elastic.Serilog.Sinks lib to send logs to Elastic with Serilog. This code sends logs to ES, but the created indexes are hidden. Why?
How can I set the index unhidden?
How can I set the index format?
public static void AddSerilog(this WebApplicationBuilder builder, IConfiguration configuration,
string environment,
string projectName)
{
var uri = configuration["Elasticsearch:Url"]!;
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.Enrich.WithElasticApmCorrelationInfo()
.Enrich.WithProperty("Project", projectName)
.Enrich.WithProperty("Environment", environment)
.Enrich.WithProperty("Coder", "Jeyhun Rahimov")
.WriteTo.Console(new EcsTextFormatter())
.WriteTo.Elasticsearch(new[] { new Uri(uri) }, opts =>
{
opts.DataStream = new DataStreamName("logs", projectName.ToLower(), environment.ToLower());
opts.TextFormatting = new EcsTextFormatterConfiguration();
opts.BootstrapMethod = BootstrapMethod.Failure;
opts.ConfigureChannel = channelOpts =>
{
channelOpts.BufferOptions = new BufferOptions
{
ExportMaxConcurrency = 10
};
};
})
.CreateLogger();
builder.Logging.ClearProviders();
builder.Host.UseSerilog(Log.Logger, true);
}
it creates hidden index like:
.ds-logs-auth-development-2024.07.18-000001