rsyslog / rsyslog-docker

rsyslog docker containers
Apache License 2.0
98 stars 49 forks source link

I'm attempting to log RFC 5424 messages, but nothing is logged. #45

Open f-steff opened 3 years ago

f-steff commented 3 years ago

I'm attempting to log RFC 5424 messages, but nothing is logged. Have tried enabling debug, but see nothing that indicates a message is even received. :-(

I have the correct port mapped (514 UDP) and verified a similar setup works with another container.

I'm using this code to send RFC 5424 formatted messages:

#!/usr/bin/python
# -*- coding: utf-8 -*-
# https://github.com/jobec/rfc5424-logging-handler
# Documentation: https://rfc5424-logging-handler.readthedocs.io/en/latest/

import sys
import logging
from rfc5424logging import Rfc5424SysLogHandler, Rfc5424SysLogAdapter

logger = logging.getLogger('rfc5424logging_test')
logger.setLevel(logging.DEBUG)

# Data specified in the handler will override default values and will be come new defaults. Can be overruled later, too.
sh = Rfc5424SysLogHandler(address=('10.0.2.2', 514),
                          #hostname="otherserver",
                          # appname="my_wonderfull_app",
                          # procid=555,
                          # structured_data={'sd_id_1': {'key1': 'value1'}},
                          enterprise_id=32473,   # required for structured data.
                          utc_timestamp=False)
logger.addHandler(sh)

adapter = Rfc5424SysLogAdapter(logger)

adapter.info('This message have structured date',
             structured_data={'sd_id2': {'key2': 'value2', 'key3': 'value3'}})

adapter.warning('This message have a special msgid',
             msgid='some_unique_msgid')

adapter.error('This message have a special msgid and structured data',
             structured_data={'sd_id2': {'key2': 'value2', 'key3': 'value3'}},
             msgid='some_unique_msgid')

# Since version 1.0 it's also possible to override the appname, hostname and procid per message
adapter.debug('Some other message',
             msgid='some_unique_msgid',
             appname="rfc5424logging_custom",
             hostname="my_hostname",
             procid="5678")
ghostman2013 commented 1 year ago

The same problem