Search code examples
seriloggraylog

Serilog Graylog cannot log in Graylog


I am new to graylog. I cannot log into graylog. When I do a search for the message, I look for source:xxx-yyy or just a keyword test9999, look for all the latest logs, my message is not there. What could I be doing wrong?

Server name and port are correct.

LoggerConfiguration loggerConfiguration = new LoggerConfiguration();
         
         loggerConfiguration
            .Enrich.FromLogContext()
            .Enrich.WithProperty("source", "xxx-yyy")
            .Enrich.WithProperty("test", "test9999");

         loggerConfiguration.WriteTo.Graylog(new GraylogSinkOptions
         {
            HostnameOrAddress = "server",
            Port = 12201,
            TransportType = TransportType.Udp,
            MinimumLogEventLevel = LogEventLevel.Information,
            Facility = "local2",
            ShortMessageMaxLength = 12000,
            StackTraceDepth = 10,
            MessageGeneratorType = MessageIdGeneratorType.Timestamp
         });



Stream Rules
Stream ZZZ
Must match at least one of the 4 configured stream rules.
source must match exactly xxx-yyy
...


Local inputs
    gelfUDP GELF UDP RUNNING
    On node  0cee9b17 / server
    bind_address: 0.0.0.0
    decompress_size_limit: 8388608
    number_worker_threads: 32
    override_source: <empty>
    port: 12201
    recv_buffer_size: 1048576

Packages

  <package id="Serilog" version="2.10.0" targetFramework="net461" />
  <package id="Serilog.Sinks.Graylog" version="2.2.1" targetFramework="net461" />
  <package id="Serilog.Sinks.Graylog.Extended" version="1.0.1" targetFramework="net461" />

Solution

  • The problem was the Stream was not setup in the server. So the solution was to setup a stream with a certain rule (that I had to add a field for), and I had to be allowed to access this stream.