Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
f-steff opened this issue Apr 19, 2021 · 1 comment
Open

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

f-steff opened this issue Apr 19, 2021 · 1 comment

Comments

@f-steff
Copy link

f-steff commented Apr 19, 2021

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
Copy link

The same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants