Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot filter minimum level only for ElasticSearch #309

Closed
pantonis opened this issue Jun 19, 2023 · 1 comment · Fixed by #328
Closed

[BUG] Cannot filter minimum level only for ElasticSearch #309

pantonis opened this issue Jun 19, 2023 · 1 comment · Fixed by #328
Labels
bug Something isn't working

Comments

@pantonis
Copy link

pantonis commented Jun 19, 2023

I cannot make this library work with the way Serilog.Sinks.ElasticSearch works by specifying MinimumLevel only for ElasticSearch and not for the File or Console Sinks. e.g As of now I can manage filtering for files but not for elastic search where I want only errors to be written in ElasticSearch

 "Serilog": {
    "Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Console", "Serilog.Expressions"],
    "MinimumLevel": {
      "Default": "Debug",
      "Override": {
        "Microsoft": "Debug",
        "System": "Debug",
        "Radius": "Debug",
        "MT4.Plugin": "Information"
      }
    },
    "WriteTo": [
      { "Name": "Console" },
      {
        "Name": "Logger",
        "Args": {
          "configureLogger": {
            "Filter": [
              {
                "Name": "ByIncludingOnly",
                "Args": {
                  "expression": "@l = 'Debug' or @l = 'Information'"
                }
              }
            ],
            "WriteTo": [
              {
                "Name": "File",
                "Args": {
                  "path": "%BASEDIR%/Logs/log.txt",
                  "rollOnFileSizeLimit": true,
                  "retainedFileCountLimit": 10,
                  "shared": true
                }
              }
            ]
          }
        }
      },
      {
        "Name": "Logger",
        "Args": {
          "configureLogger": {
            "Filter": [
              {
                "Name": "ByExcluding",
                "Args": {
                  "expression": "@l = 'Debug' or @l = 'Information'"
                }
              }
            ],
            "WriteTo": [
              {
                "Name": "File",
                "Args": {
                  "path": "%BASEDIR%/Logs/error.txt",
                  "rollOnFileSizeLimit": true,
                  "retainedFileCountLimit": 10,
                  "shared": true
                }
              }
            ]
          }
        }
      },
@pantonis pantonis added the bug Something isn't working label Jun 19, 2023
@Mpdreamz
Copy link
Member

Mpdreamz commented Aug 3, 2023

Thanks for bringing this to my attention!

Opened #328 to address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants