I am not getting mutiple Controller log in Kibana Dashboard ? any one have idea about this... Log Override [Result display last controller log]

SecondController

public class SecondController : Controller
{
private readonly ILogger _logger;

    public SecondController(ILogger<SecondController> logger)
    {
        _logger = logger;
        _logger.LogInformation("This is Second COntroller ");
    }
    public IActionResult Index()
    {
        _logger.LogInformation("This is Second COntroller Index");

        return View();
    }
}

Program.cs

public static void Main(string args)
{
CreateHostBuilder(args).Build().Run();
}

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        .UseSerilog()
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>();
        });

}

Startup

Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.MinimumLevel.Information()
.WriteTo.Http(requestUri: "http://localhost:8080", queueLimitBytes: null)
.CreateLogger();

FirstController

private readonly ILogger _logger;

    public HomeController(ILogger<HomeController> logger)
    {
        _logger = logger;
        _logger.LogInformation("This is Home COntroller Webapp");
    }

    public IActionResult Index()
    {
        _logger.LogInformation("This is Home COntroller Index");
        return View();
    }

appsetting

"Serilog": {
"MinimumLevel": "Info",
"WriteTo": [
{
"Name": "Http",
"Args": {
"requestUri": "http://localhost:8080",
"queueLimitBytes": null
}
}
]
},

Hi Jignesh, and welcome!

This looks like Serilog code. I've never used it, but I think the Http output will write in a format Elasticsearch can't understand.

I'd recommend trying GitHub - serilog-contrib/serilog-sinks-elasticsearch: A Serilog sink that writes events to Elasticsearch

If it doesn't work as expected, opening an issue on Issues · serilog-contrib/serilog-sinks-elasticsearch · GitHub would probably be the best bet.

Good luck!

Thank you...

log is generate in file so how can i read log from file an generate on Kibana Dashboard.....

No problem :slight_smile:

You can use the filestream input to read the data into Elasticsearch (filestream input | Filebeat Reference [8.3] | Elastic)

Once it's stored in Elasticsearch you can use Lens to build dashboards from the stored data.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.