Serilog Graylog无法登录Graylog

问题描述 投票:0回答:2

我是 graylog 的新手。我无法登录 graylog。当我搜索消息时,我寻找 source:xxx-yyy 或只是一个关键字 test9999,寻找所有最新的日志,我的消息不在那里。我做错了什么?

服务器名称和端口正确。

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

套餐

  <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" />
serilog graylog
2个回答
2
投票

问题是服务器中没有设置 Stream。所以解决方案是设置一个具有特定规则的流(我必须为其添加一个字段),并且我必须被允许访问这个流。


0
投票

在我看来,你应该首先确保想要的端口是开放的,然后用下面的命令生成一个独立的日志。

对于Windows:

C:\> EVENTCREATE /T ERROR /ID 1000 /L APPLICATION /D "My application error mesaage"

对于 Linux:

# logger -s "This is a test message" 

但是接下来在服务器 graylog 上使用下面的命令检查接收日志

#tcpdump host <IP>  and port 5514 -vv

在搜索栏部分搜索生成的日志,并确保收到指定端口的日志

© www.soinside.com 2019 - 2024. All rights reserved.