I have serilog configuration in app setting file and wanted the separate index for Error and Debug/information/verbose/fatal/warning. So i had created sub loggers and added the sinks for elastic search but errors are still logging into the index "test-" which suppose to not log error, and nothing is logging in to "testerror-" index which suppose to log error.
Can someone advise how i can resolve this issue.
"Serilog": {
"MinimumLevel": {
"Default": "debug",
"Override": {
"System": "Warning",
"Microsoft": "Warning",
}
},
"WriteTo": [
{"Name": "Logger",
"Args": {
"configureLogger": {
"MinimumLevel": {
"Default": "Verbose"
},
"Filter": [
{
"Name": "ByExcluding",
"Args": {
"expression": "StartsWith(Level, 'Error')"
}
}
],
"WriteTo": [
{
"Name": "Elasticsearch",
"Args": {
"nodeUris": "http://localhost:9200",
"indexFormat": "test-log",
"templateName": "template"
}
}
]
}
}
},
{
"Name": "Logger",
"Args": {
"configureLogger": {
"MinimumLevel": {
"Default": "Error"
},
"Filter": [
{
"Name": "ByIncludingOnly",
"Args": {
"expression": "StartsWith(Level, 'Error')"
}
}
],
"WriteTo": [
{
"Name": "Elasticsearch",
"Args": {
"nodeUris": "http://localhost:9200",
"indexFormat": "testerror-log",
"templateName": "error-template"
}
}
]
}
}
}
]