【问题标题】:Graylog Collector Connection RefusedGraylog 收集器连接被拒绝
【发布时间】:2015-11-15 10:15:00
【问题描述】:

我正在尝试创建一个 Graylog 服务器 - Graylog 收集器设置,其中 graylog 收集器在一台机器上收集系统日志文件并将它们发送到服务器。

我已使用 AWS AMI 创建 Graylog 服务器,它按预期工作。

我在同一台机器上安装了 Graylog 收集器,我可以在该实例的源列表中看到它。

我的问题是当我尝试连接到远程 Graylog 收集器时。

Graylog Collector 配置文件如下所示:

server-url = "http://xxx.xxx.xxx.xxx:12900/"

inputs {  
  syslog {
    type = "file"
    path = "/var/log/syslog"
  }     
}

outputs {
  graylog-server {
    type = "gelf"
    host = "xxx.xxx.xxx.xxx"
    port = 12201
  } 
}    

其中 xxx.xxx.xxx.xxx 是我尝试连接的 graylog 服务器的私有 IP 地址。

graylog 服务器的配置摘录如下:

rest_listen_uri = http://0.0.0.0:12900/

两个实例的安全组如下:

-----------------------------------------------------------------
| Type            | Protocol        | Port Range   |  Source    |
-----------------------------------------------------------------
| Custom TCP Rule | TCP             | 12201        |  0.0.0.0/0 |
-----------------------------------------------------------------
| Custom TCP Rule | TCP             | 12900        |  0.0.0.0/0 |
-----------------------------------------------------------------

当我查看 graylog 收集器的日志时,我收到以下消息:

2015-11-14T23:41:33.948+0000 ERROR [gelfTcpTransport-1-1] gelfclient.transport.GelfTcpTransport - Connection failed: Connection refused: /xxx.xxx.xxx.xxx:12201
2015-11-14T23:41:34.949+0000 ERROR [gelfTcpTransport-1-1] gelfclient.transport.GelfTcpTransport - Connection failed: Connection refused: /xxx.xxx.xxx.xxx:12201
2015-11-14T23:41:35.951+0000 ERROR [gelfTcpTransport-1-1] gelfclient.transport.GelfTcpTransport - Connection failed: Connection refused: /xxx.xxx.xxx.xxx:12201
2015-11-14T23:41:36.953+0000 ERROR [gelfTcpTransport-1-1] gelfclient.transport.GelfTcpTransport - Connection failed: Connection refused: /xxx.xxx.xxx.xxx:12201
2015-11-14T23:41:37.956+0000 ERROR [gelfTcpTransport-1-1] gelfclient.transport.GelfTcpTransport - Connection failed: Connection refused: /xxx.xxx.xxx.xxx:12201
2015-11-14T23:41:38.698+0000 WARN  [HeartbeatService RUNNING] collector.heartbeat.HeartbeatService - Unable to send heartbeat to Graylog server: ConnectException: Connection refused

(同样,xxx.xxx.xxx.xxx 是我尝试连接的 graylog 服务器的私有 IP 地址)

我已经在端口 12201 和端口 12900 上的两台机器之间运行了 traceroute,没有任何问题。

谁能告诉我我的配置中可能缺少什么以允许这两个连接?

两者都运行 Ubuntu 14.04。

谢谢,

肖恩

【问题讨论】:

  • 更新 - 我已经在端口 12201 上的 graylog 服务器上创建了 GELF TCP 输入。我现在收到的错误消息是:2015-11-16T09:35:04.689+0000 WARN [ HeartbeatService RUNNING] collector.heartbeat.HeartbeatService - 无法将心跳发送到 Graylog 服务器:ConnectException:连接被拒绝所以看起来它已经工作到一定程度,但我仍然无法在列表中查看在客户端上运行的收集器系统 > 收集器页面上的收集器。我想我可以在 graylog 收集器的配置中禁用心跳注册(但我宁愿不这样做)。
  • 我遇到了同样的问题。在我的例子中,Graylog 服务器是本地实例化的,使用 vagrant 虚拟机。我正在研究,如果我有解决方案,我会在这里发布。问候。

标签: tcp graylog2 graylog


【解决方案1】:

尝试更改 Graylog Web 中的设置,"System -> Inputs" 菜单,编辑从端口 12201 侦听的输入设置(在我的例子中称为 "Appliance Gelf UDP" ),并将 "Bind Adress" 更改为您的私有 IP。就我而言,一切都在 localhost(收集器和包含 Graylog 服务器的 vagrant 虚拟机)中,我写了 "127.0.0.1",并且 "HeartbeatService RUNNING] collector.heartbeat.HeartbeatService - Unable to send heartbeat to Graylog server: ConnectException: Connection refused" 错误消息已从 Graylog 收集器的日志中消失。

这是一个健康收集器开始的 STDOUT 输出:

2015-12-18T12:26:24.027+0100 INFO  [main] cli.commands.Run - Starting Collector v0.4.1 (commit 36a0856)
2015-12-18T12:26:24.032+0100 INFO  [main] cli.commands.Run - Running on Windows 8.1 Windows 8.1 6.3 (amd64)
2015-12-18T12:26:25.311+0100 INFO  [main] collector.utils.CollectorId - Collector ID: ff0f70f5-2d48-4b5c-9943-88031ea5e0fc
2015-12-18T12:26:25.349+0100 INFO  [main] outputs.gelf.GelfOutput - Starting GELF transport: org.graylog2.gelfclient.GelfConfiguration@7ca65d82
2015-12-18T12:26:25.761+0100 INFO  [gelfTcpTransport-1-1] gelfclient.transport.GelfTcpTransport - Channel disconnected!
2015-12-18T12:26:25.761+0100 INFO  [main] cli.commands.Run - Service RUNNING: BufferProcessor [RUNNING]
2015-12-18T12:26:25.761+0100 INFO  [main] cli.commands.Run - Service RUNNING: FileObserver [RUNNING]
2015-12-18T12:26:25.761+0100 INFO  [main] cli.commands.Run - Service RUNNING: MemoryReporterService [RUNNING]
2015-12-18T12:26:25.761+0100 INFO  [main] cli.commands.Run - Service RUNNING: MetricService [RUNNING]
2015-12-18T12:26:25.762+0100 INFO  [main] cli.commands.Run - Service RUNNING: HeartbeatService [RUNNING]
2015-12-18T12:26:25.764+0100 INFO  [main] cli.commands.Run - Service RUNNING: GelfOutput{port='12201', id='gelf-tcp', client-send-buffer-size='-1', host='127.0.0.1', inputs='', client-reconnect-delay='1000', client-connect-timeout='5000', client-tcp-no-delay='true', client-queue-size='512'}

【讨论】:

    【解决方案2】:

    心跳错误与graylog-collector注册到graylog-server有关。采集器需要向 Graylog 服务器注册,才能出现在 Web 界面的 System->Collector 菜单中。 在 graylog-collector 配置文件集中 “启用注册 = false”(不带引号) 作为全局配置来消除这个心跳错误。 这将消除心跳错误,并且日志仍将继续保存在 graylog 服务器上,没有任何问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-08
      • 2011-01-23
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2018-08-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多