เพิ่ม middleware ในการเขียน log โดยเขียนไป elasticsearch โดยไม่ใช้ Serilog เพื่อจัด format เอง
This commit is contained in:
parent
71a1c48392
commit
b8fef58b28
6 changed files with 130 additions and 10 deletions
|
|
@ -174,6 +174,7 @@ var app = builder.Build();
|
|||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
app.UseMiddleware<RequestLoggingMiddleware>();
|
||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||
{
|
||||
Authorization = new[] { new CustomAuthorizeFilter() }
|
||||
|
|
@ -223,7 +224,8 @@ ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration,
|
|||
return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? ""))
|
||||
{
|
||||
AutoRegisterTemplate = true,
|
||||
IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||
IndexFormat = "bma-ehr-log-index",
|
||||
//IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@
|
|||
}
|
||||
},
|
||||
"ElasticConfiguration": {
|
||||
"Uri": "http://localhost:9200"
|
||||
"Uri": "http://192.168.1.40:9200"
|
||||
},
|
||||
"LogIndex": "bma-ehr-log-index",
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue