Open Closed

Log file format #2589


User avatar
0
viswajwalith created
  • ABP Framework version: v5.3
  • UI type: MVC
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes

We are trying to save the Log file in a specific format "Log_YYY-MM-DD.txt" but not able to see any option with SerilogConfigurationHelper.Configure method

We tried by overriding the logic like below, with that we are getting the file name in the required format but not able to see data in Elastic search

Please advise.


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Are u call the WriteTo.Elasticsearch method?

    .WriteTo.Elasticsearch(
        new ElasticsearchSinkOptions(new Uri(configuration["ElasticSearch:Url"]))
        {
            AutoRegisterTemplate = true,
            AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6,
            IndexFormat = "MyProjectName-log-{0:yyyy.MM}"
        })
    
  • User Avatar
    0
    viswajwalith created

    Are u call the WriteTo.Elasticsearch method?

    .WriteTo.Elasticsearch( 
        new ElasticsearchSinkOptions(new Uri(configuration["ElasticSearch:Url"])) 
        { 
            AutoRegisterTemplate = true, 
            AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6, 
            IndexFormat = "MyProjectName-log-{0:yyyy.MM}" 
        }) 
    

    That means we need to add the custom code to write to elastic search right? But when using SerilogConfigurationHelper it it taking care automatically by the respective helper right?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes, You can copy the code from the SerilogConfigurationHelper .

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15