fluent / fluentd

Fluentd: Unified Logging Layer (project under CNCF)

Home Page:https://www.fluentd.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configure the websocket output plugin

Wangsenshuai opened this issue · comments

Describe the bug

In fluent-pagecke5LTS, configure the fluent-plugin-websocket plug-in and output to port 8082. The fluent log shows that the port is occupied, but lsof sees that the port is started with fluentd and that the process name is not ruby, but fluentd. I want to know how to configure it correctly

To Reproduce

systemctl restart fluentd -v checks logs after fluentd

Expected behavior

The webscoket connection is normal and the startup process is ruby

Your Environment

- Fluentd version: fluentd 1.16.3 
- TD Agent version: fluent-package 5.0.2
- Operating system: AlmaLinux 8.9
- Kernel version: 4.18.0-513.9.1.el8_9.x86_64

Your Configuration

24-01-11 03:29:40 +0000 [info]: fluent/log.rb:362:info: using configuration file: <ROOT>
  <source>
    @type forward
    port 24224
  </source>
  <match test.*>
    @type copy
    <store>
      @type "websocket"
      port 8082
      add_tag false
    </store>
    <store>
      @type "flowcounter"
      @id flowcounter
      count_keys *
    </store>
  </match>
  <match flowcount>
    @type file
    path "/var/log/fluent/flowcounter.log"
    append true
    <buffer time>
      path "/var/log/fluent/flowcounter.log"
    </buffer>
  </match>

Your Error Log

2024-01-11 03:29:40 +0000 [info]: fluent/log.rb:362:info: starting fluentd-1.16.3 pid=303350 ruby="3.2.2"
2024-01-11 03:29:41 +0000 [info]: fluent/log.rb:362:info: spawn command to main:  cmdline=["/opt/fluent/bin/ruby", "-Eascii-8bit:ascii-8bit", "/sbin/fluentd", "-v", "--under-supervisor"]
2024-01-11 03:29:41 +0000 [info]: #0 fluent/log.rb:362:info: init worker0 logger path=nil rotate_age=nil rotate_size=nil
2024-01-11 03:29:41 +0000 [info]: fluent/log.rb:362:info: adding match pattern="iotpf.event.log.*" type="copy"
2024-01-11 03:29:41 +0000 [debug]: #0 fluent/log.rb:341:debug: adding store type="websocket"
2024-01-11 03:29:41 +0000 [debug]: #0 fluent/log.rb:341:debug: adding store type="flowcounter"
2024-01-11 03:29:41 +0000 [info]: #0 fluent/log.rb:362:info: WebSocket server 10.24.98.51:8082 [msgpack: false]
#<Thread:0x00007f704df16ae8 /opt/fluent/lib/ruby/gems/3.2.0/gems/fluent-plugin-websocket-0.1.8/lib/fluent/plugin/out_websocket.rb:35 run> terminated with exception (report_on_exception is true):
/opt/fluent/lib/ruby/gems/3.2.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)
        from /opt/fluent/lib/ruby/gems/3.2.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:531:in `start_server'
        from /opt/fluent/lib/ruby/gems/3.2.0/gems/em-websocket-0.5.3/lib/em-websocket/websocket.rb:46:in `run'
        from /opt/fluent/lib/ruby/gems/3.2.0/gems/fluent-plugin-websocket-0.1.8/lib/fluent/plugin/out_websocket.rb:39:in `block (2 levels) in configure'
        from /opt/fluent/lib/ruby/gems/3.2.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run_machine'
        from /opt/fluent/lib/ruby/gems/3.2.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run'
        from /opt/fluent/lib/ruby/gems/3.2.0/gems/fluent-plugin-websocket-0.1.8/lib/fluent/plugin/out_websocket.rb:38:in `block in configure'
2024-01-11 03:29:41 +0000 [info]: fluent/log.rb:362:info: adding match pattern="flowcount" type="file"
2024-01-11 03:29:42 +0000 [info]: fluent/log.rb:362:info: adding source type="forward"
2024-01-11 03:29:42 +0000 [debug]: #0 fluent/log.rb:341:debug: No fluent logger for internal event
2024-01-11 03:29:42 +0000 [info]: #0 fluent/log.rb:362:info: starting fluentd worker pid=303355 ppid=303350 worker=0
2024-01-11 03:29:42 +0000 [debug]: #0 fluent/log.rb:341:debug: restoring buffer file: path = /var/log/fluent/flowcounter.log/buffer.b60ea312326824b2358760eeb343bda66.log
2024-01-11 03:29:42 +0000 [debug]: #0 fluent/log.rb:341:debug: buffer started instance=2240 stage_size=273 queue_size=0
2024-01-11 03:29:42 +0000 [info]: #0 fluent/log.rb:362:info: listening port port=24224 bind="0.0.0.0"
2024-01-11 03:29:42 +0000 [error]: #0 fluent/log.rb:404:error: unexpected error error_class=Errno::EADDRINUSE error="Address already in use - bind(2) for 0.0.0.0:24224"
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/3.2.0/socket.rb:205:in `bind'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/3.2.0/socket.rb:205:in `listen'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/plugin_helper/server.rb:376:in `server_create_tcp_socket'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/plugin_helper/server.rb:212:in `server_create_for_tcp_connection'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/plugin_helper/server.rb:92:in `server_create_connection'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/plugin/in_forward.rb:172:in `start'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:203:in `block in start'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:192:in `block (2 levels) in lifecycle'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:191:in `each'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:191:in `block in lifecycle'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:178:in `each'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:178:in `lifecycle'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/root_agent.rb:202:in `start'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/engine.rb:248:in `start'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/engine.rb:147:in `run'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/supervisor.rb:617:in `block in run_worker'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/supervisor.rb:962:in `main_process'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/supervisor.rb:608:in `run_worker'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/lib/fluent/command/fluentd.rb:372:in `<top (required)>'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: <internal:/opt/fluent/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: <internal:/opt/fluent/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/lib/ruby/gems/3.2.0/gems/fluentd-1.16.3/bin/fluentd:15:in `<top (required)>'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/bin/fluentd:25:in `load'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /opt/fluent/bin/fluentd:25:in `<top (required)>'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /sbin/fluentd:15:in `load'
  2024-01-11 03:29:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /sbin/fluentd:15:in `<main>'

Additional context

No response