ecs-dotnet icon indicating copy to clipboard operation
ecs-dotnet copied to clipboard

[QUESTION] Support for log forwarding through Elastic Agent using Custom HTTP Logs integration

Open mattmichal opened this issue 1 year ago • 0 comments

Is it possible to use the Elastic.Serilog.Sinks package to send logs to an Elastic Agent having the Custom HTTP Logs integration?

From serilog-contrib/serilog-sinks-elasticsearch#486:

Elastic.Serilog.Sinks will not only target Elasticsearch. Long term we will explore it sending data to our APM product, OTLP, Logstash, Elastic Agent and many others.

In my testing with an agent having the custom logs integration listening on port 8080, I'm getting an error.

config.WriteTo.Elasticsearch(new[] { new Uri("http://localhost:8080") }, opts =>
{
    opts.DataStream = new DataStreamName("logs", "dotnet", "default");
    opts.BootstrapMethod = BootstrapMethod.Failure;
});

Error:

System.Exception: Failure to create component template `ecs_8.11.0_agent` for logs-dotnet-*: Invalid Elasticsearch response built from a unsuccessful (405) low level call on PUT: /_component_template/ecs_8.11.0_agent
Exception: Failed to ping the specified node. Call: Status code 405 from: HEAD /

If this is not supported, is it planned?

Is there an alternate way to use Serilog to send logs via an agent? We have certain authorization considerations that will not allow us to push logs directly to our Elastic Cloud instance.

mattmichal avatar Jun 26 '24 22:06 mattmichal