2

I have started the fluentd server with docker.My fluentd configuration is

<source> @type syslog port 514 bind 0.0.0.0 tag system </source> <match **> @type stdout </match> 

The command I used to start the fluentd server is

docker run -p 514:514 -v $(pwd)/tmp:/fluentd/etc fluent/fluentd:edge-debian -c /fluentd/etc/fluentd.conf 

It starts the server successfully and I get the log

2023-09-20 16:05:18 +0000 [info]: init supervisor logger path=nil rotate_age=nil rotate_size=nil 2023-09-20 16:05:18 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluentd.conf" 2023-09-20 16:05:18 +0000 [info]: gem 'fluentd' version '1.16.2' 2023-09-20 16:05:18 +0000 [warn]: define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead 2023-09-20 16:05:18 +0000 [info]: using configuration file: <ROOT> <source> @type syslog port 514 bind "0.0.0.0" tag "system" </source> <match **> @type stdout </match> </ROOT> 2023-09-20 16:05:18 +0000 [info]: starting fluentd-1.16.2 pid=7 ruby="3.1.4" 2023-09-20 16:05:18 +0000 [info]: spawn command to main: cmdline=["/usr/local/bin/ruby", "-Eascii-8bit:ascii-8bit", "/usr/local/bundle/bin/fluentd", "-c", "/fluentd/etc/fluentd.conf", "--plugin", "/fluentd/plugins", "--under-supervisor"] 2023-09-20 16:05:19 +0000 [info]: #0 init worker0 logger path=nil rotate_age=nil rotate_size=nil 2023-09-20 16:05:19 +0000 [info]: adding match pattern="**" type="stdout" 2023-09-20 16:05:19 +0000 [info]: adding source type="syslog" 2023-09-20 16:05:19 +0000 [warn]: #0 define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead 2023-09-20 16:05:19 +0000 [info]: #0 starting fluentd worker pid=16 ppid=7 worker=0 2023-09-20 16:05:19 +0000 [info]: #0 listening syslog socket on 0.0.0.0:514 with udp 2023-09-20 16:05:19 +0000 [info]: #0 fluentd worker is now running worker=0 2023-09-20 16:05:19.058192424 +0000 fluent.info: {"pid":16,"ppid":7,"worker":0,"message":"starting fluentd worker pid=16 ppid=7 worker=0"} 2023-09-20 16:05:19.058414751 +0000 fluent.info: {"message":"listening syslog socket on 0.0.0.0:514 with udp"} 2023-09-20 16:05:19.059112948 +0000 fluent.info: {"worker":0,"message":"fluentd worker is now running worker=0"} 

I have wrote the simple python script to test the connection which is as follows

import logging import logging.handlers import socket if __name__ == "__main__": syslogger = logging.getLogger('SyslogLogger') handler = logging.handlers.SysLogHandler(address=("0.0.0.0", 514), facility=19, socktype=socket.SOCK_DGRAM) syslogger.addHandler(handler) syslogger.info("Hello World") 

Script runs without any error but I don't get any log on the on the fluentd.

Server and script both are on a local machine.

7
  • Use syslog input plugin instead of http. Commented Sep 21, 2023 at 5:30
  • I just observed that the config you're showing in the first part has http source but in the logs the loaded config is showing syslog source. And, the port you're using with docker is 9880, not 514. For a simpler setup, you can test this on your local machine first and then move on to docker to emulate the same. Commented Sep 21, 2023 at 5:35
  • Sorry yeah I fixed all those those things http -> syslog and using correct port in docker container. I copied the wrong config file while creating the question. Still the issue is the same. Commented Sep 21, 2023 at 17:15
  • Right. Is your Python script able to send logs to your local syslog? Have you tested it? Commented Sep 22, 2023 at 6:44
  • 1
    Thanks but I found the actual problem and updated the answer. Commented Sep 22, 2023 at 7:03

1 Answer 1

1

I found the solution issue was with docker adding /udp suffix while exposing the port solved my problem. Docker UDP port support?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.