asp.netweb-configserilog.net-4.8graylog

Configuring Graylog on Web.Config class


I want to configure Graylog in web.Config file but for some reason, logs are not being sent. (configuring on JSON is not an option):

<add key="serilog:using:Graylog" value="Serilog.Sinks.Graylog" />
<add key="serilog:write-to:Graylog.hostnameOrAdress" value="URL" />
<add key="serilog:write-to:Graylog.port" value="12201" />
<add key="serilog:write-to:Graylog.transportType" value="Http" />

But I checked and I am able to send logs to Graylog if i configure it in my Serilog Init class

var logger = new LoggerConfiguration()
    .ReadFrom.AppSettings().WriteTo.Graylog(new GraylogSinkOptions
    {
        HostnameOrAddress = "URL",
        Port = 12201,
        TransportType = TransportType.Http
    })
    .CreateLogger();

What could be the problem?


Solution

  • Just found out my mistake. Made a typo: instead of address I wrote adress :)

    wrong:

    <add key="serilog:write-to:Graylog.hostnameOrAdress" value="URL" />
    

    should be:

    <add key="serilog:write-to:Graylog.hostnameOrAddress" value="URL" />