api log to elastic
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
|
<PackageReference Include="Elastic.CommonSchema.Serilog" Version="8.6.1" />
|
||||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
|
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Elastic.CommonSchema.Serilog;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using PARR.API.Installers;
|
using PARR.API.Installers;
|
||||||
using PARR.BLL;
|
using PARR.BLL;
|
||||||
@@ -9,9 +10,12 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
|
|
||||||
builder.Host.UseSerilog((context, config) =>
|
builder.Host.UseSerilog((context, config) =>
|
||||||
{
|
{
|
||||||
config
|
if (context.HostingEnvironment.IsProduction())
|
||||||
.WriteTo.Console()
|
config.WriteTo.Console(new EcsTextFormatter());
|
||||||
.ReadFrom.Configuration(builder.Configuration);
|
else
|
||||||
|
config.WriteTo.Console();
|
||||||
|
|
||||||
|
config.ReadFrom.Configuration(builder.Configuration);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|||||||
@@ -5,6 +5,15 @@
|
|||||||
"Microsoft.AspNetCore": "Debug"
|
"Microsoft.AspNetCore": "Debug"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Serilog": {
|
||||||
|
"MinimumLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Override": {
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"StorageSettings": {
|
"StorageSettings": {
|
||||||
"StoragePath": "W:\\"
|
"StoragePath": "W:\\"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ services:
|
|||||||
#volumes:
|
#volumes:
|
||||||
#- /var/log/parr-api:/app/log
|
#- /var/log/parr-api:/app/log
|
||||||
#- parr_storage_dev:/app/Data
|
#- parr_storage_dev:/app/Data
|
||||||
|
logging:
|
||||||
|
driver: fluentd
|
||||||
|
options:
|
||||||
|
fluentd-address: dvgd-mng-02.dvgd.oao.rzd:24224
|
||||||
|
tag: parr.api.serilog
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user