Search code examples
.net-coregelf

How to run GELF Extension logger?


I run the sample for NET Core: [https://github.com/mattwcole/gelf-extensions-logging/blob/dev/samples/Gelf.Extensions.Logging.Samples.NetCore2/Program.cs][1]

Then I have ran Docker https://docs.graylog.org/en/4.0/pages/installation/docker.html?highlight=docker

Then I little bit corrected appsettings.json file:

{
  "Logging": {
    "Console": {
      "LogLevel": {
        "Default": "Debug"
      }
    },
    "GELF": {
      "Host": "127.0.0.1",
      "Port": 12201,
      "LogSource": "console-app-1",
      "LogLevel": {
        "Default": "Debug",
        "Microsoft": "Debug",
        "Gelf.Extensions.Logging.Samples.NetCore2": "Debug",
        "Gelf.Extensions.Logging.Samples.NetCore2.Program": "Debug"
      },
      "LogLevel2": {
        "Microsoft.AspNetCore.Mvc.Razor": "Error",
        "Default": "Trace"
      },
      "AdditionalFields": {
        "project_name": "my-project"
      }
    }
  }
}

Run the application, it works but when I go to browser http://localhost:9000/search?q=&rangetype=relative&relative=1800 I do not see any records. What I do wrong?


Solution

  • Need to check the Docker GrayLog Configuration: especially GELF Input local and global.