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

logging.handlers.SysLogHandler with TCP not working on rsyslog5.8 #71560

Closed
ghost opened this issue Jun 23, 2016 · 4 comments
Closed

logging.handlers.SysLogHandler with TCP not working on rsyslog5.8 #71560

ghost opened this issue Jun 23, 2016 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ghost
Copy link

ghost commented Jun 23, 2016

BPO 27373
Nosy @vsajip, @matrixise
Files
  • fail.log: the tcpdump result of sending message with TCP
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-08-06.16:25:28.514>
    created_at = <Date 2016-06-23.09:04:31.770>
    labels = ['invalid', 'type-bug', 'library']
    title = 'logging.handlers.SysLogHandler with TCP not working on rsyslog5.8'
    updated_at = <Date 2016-08-06.16:25:28.513>
    user = None

    bugs.python.org fields:

    activity = <Date 2016-08-06.16:25:28.513>
    actor = 'vinay.sajip'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-08-06.16:25:28.514>
    closer = 'vinay.sajip'
    components = ['Library (Lib)']
    creation = <Date 2016-06-23.09:04:31.770>
    creator = '\xe5\x90\xb4\xe5\x86\x89\xe6\xb3\xa2'
    dependencies = []
    files = ['43518']
    hgrepos = []
    issue_num = 27373
    keywords = []
    message_count = 4.0
    messages = ['269112', '269118', '272081', '272082']
    nosy_count = 3.0
    nosy_names = ['vinay.sajip', 'matrixise', '\xe5\x90\xb4\xe5\x86\x89\xe6\xb3\xa2']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue27373'
    versions = ['Python 2.7']

    @ghost
    Copy link
    Author

    ghost commented Jun 23, 2016

    logging.handlers.SysLogHandler with TCP not working on rsyslog5.8, but newer version rsyslog8.19 is fine.

    I use SysLogHandler with TCP to send message to remote rsyslog server failed, but success with bash below:

    echo "<133>$0[$$]: Test syslog message from Netcat" | nc -w1 -t 192.168.1.23 514

    this is my script:
    #!/usr/bin/env python
    # -- coding: utf-8 --
    import logging
    import logging.handlers
    import socket
    import syslog

    my_logger = logging.getLogger('MyLogger')  # logger is singleton
    my_logger.setLevel(logging.DEBUG)
    
    if __name__ == '__main__':
    
        handler = logging.handlers.SysLogHandler(address=('192.168.1.23', 514), facility="auth", socktype=socket.SOCK_STREAM)
        my_logger.addHandler(handler)
        my_logger.critical('this is critical')
    
        handler.flush()
        handler.close()
        my_logger.removeHandler(handler)

    CentOS version is 6.6
    Python version is 2.7.10

    This is easy to repeat on my serval CentOS Server. And I attach tcpdump result of script and bash.

    Repository owner added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jun 23, 2016
    @vsajip
    Copy link
    Member

    vsajip commented Jun 23, 2016

    If it works fine with rsyslog 8.19 but fails with rsyslog 5.8, what exactly is logging doing wrong? How is rsyslog configured in the two cases? How exactly was the fail.log generated (I know you said tcpdump was used, but can you provide more detail)?

    I'm not sure I'll be able to reproduce this, so you may need to identify what you think logging is doing wrong (there have been no changes in SysLogHandler for quite a while, AFAIK).

    @vsajip
    Copy link
    Member

    vsajip commented Aug 6, 2016

    If no more information is available, I will close this issue soon as "not a bug".

    @matrixise
    Copy link
    Member

    For me, it's an issue with the management of the protocol in rsyslog and not with the logging library.

    You can close the issue.

    @vsajip vsajip closed this as completed Aug 6, 2016
    @vsajip vsajip added the invalid label Aug 6, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants