Skip to content

Instantly share code, notes, and snippets.

@xuanye
Created December 15, 2021 01:50
Show Gist options
  • Save xuanye/7a1abb72c54752cc83984d24b361df08 to your computer and use it in GitHub Desktop.
Save xuanye/7a1abb72c54752cc83984d24b361df08 to your computer and use it in GitHub Desktop.
Serilog ,console,file,ES
{
"using": [
"Serilog.Sinks.Async",
"Serilog.Sinks.Console",
"Serilog.Sinks.File",
"Serilog.Sinks.Elasticsearch",
"Serilog.Formatting.Elasticsearch",
"Serilog.Expressions"
],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"WriteTo": [
{
"Name": "Logger",
"Args": {
"configureLogger": {
"WriteTo": [
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "Console",
"Args": {
"restrictedToMinimumLevel": "Information",
"outputTemplate": "[{Timestamp:HH:mm:ss} {SourceContext} [{Level:u3}] {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "../logs/datastorage-grpc/log_.log",
"rollingInterval": "Day",
"restrictedToMinimumLevel": "Information",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} {SourceContext} [{Level:u3}] {Message}{NewLine}{Exception}"
}
},
{
"Name": "Elasticsearch",
"Args": {
"nodeUris": "http://165.88.125.128:9200;",
"indexFormat": "datastorage-grpc-{0:yyyy.MM}",
"batchPostingLimit": 50,
"batchAction": "Create",
"period": 2,
"inlineFields": true,
"restrictedToMinimumLevel": "Information",
"detectElasticsearchVersion": true,
"autoRegisterTemplate": true,
"autoRegisterTemplateVersion": "ESv7"
}
}
]
}
}
],
"Filter": [
{
"Name": "ByExcluding",
"Args": {
"expression": "EndsWith(SourceContext, 'AuditLogger')"
}
}
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment