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

No messages inside syslog server #29

Open
alexvassel opened this issue Mar 22, 2016 · 8 comments
Open

No messages inside syslog server #29

alexvassel opened this issue Mar 22, 2016 · 8 comments

Comments

@alexvassel
Copy link

Hi. Running your example server.

When I try to log something from other go code or python script, I get empty log message like

map[hostname: tag: content: facility:0 severity:0 client:127.0.0.1:60172 tls_peer: timestamp:0001-01-01 00:00:00 +0000 UTC priority:0]

Python script is very simple

import logging
import logging.handlers

my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)

handler = logging.handlers.SysLogHandler(address = ('localhost',514), facility=19)

my_logger.addHandler(handler)

my_logger.debug('this is debug')

Simple as Go one

package main

import (
    "log/syslog"
)

func main() {
    connectionAddress := "localhost:514"

    syslogWriter, _ := syslog.Dial("udp", connectionAddress, syslog.LOG_ERR, "INFO logger")

    syslogWriter.Warning("wrn")

}

Did I forget something?

Thanks in advance.

@evildecay
Copy link

@alexvassel
example code: server.SetFormat(syslog.RFC5424)
change into : server.SetFormat(syslog.Automatic)

@alexvassel
Copy link
Author

Thanks.

Same problem.

I already tried this.

@bgv
Copy link

bgv commented Jun 10, 2016

Same issue here, I'm piping messages trough logger and when using with default rsyslog messages are here when shut it down and start go-syslog default example nothing happens.

Any advice on this?

@abligh
Copy link
Contributor

abligh commented Jun 10, 2016

I'm pretty sure this worked once upon a time. You might try the example and with commit a2d3207 which was when my automatic parsing stuff got merged, I think. Then bisect.

@bgv
Copy link

bgv commented Jun 10, 2016

Ok, update it's working but it's kinda VERY strict on RFC

Got the latest logger from utils-linux and works flawlessly now and logs everything I throw at it.

@abligh the current stable version is just fine seems the problem was the msg compliance with the RFC's

So advice for everyone else double check what format your app produces!

@abligh
Copy link
Contributor

abligh commented Jun 11, 2016

The autodetect stuff I wrote is quite strict on RFCs because if people don't follow the RFCs, it's ambiguous which decoder it should use. It can then pick the wrong decoder, which in turn drops the packet in its entirety later on in the decode. This can be resolved by explicitly setting the format, as the decoders themselves are more lax. I seem to recall one case where the only way to reserve early ambiguity is to look at something strange in the time format.

If it's so strict with RFCs that even when a format is explicitly selected it fails and the source is a well known application (e.g. rsyslog) then arguably that's a bug, and should be fixed.

@bgv
Copy link

bgv commented Jun 11, 2016

@abligh don't think it's a bug, in my particular case the problem was in outdated seemingly logger, now it had no problem sending logs to rsyslog but messages were just not showing in go-syslog example server.

Once i got it upgraded to the latest version which have support for different RFC's and by default outputs RFC5424 compliant messages the issue went away this makes me think that logger had a bit flaky protocol and seems rsyslog has a bit more relaxed view on how the RFC's should be implemented.

As for your modifications before logger update neither explicit RFC selection or Automatic mode were of any help. After upgrading logger it works in either mode :)

@Manikandan-Raj
Copy link

@bgv I am also facing the same issue, logger messages which is not visible in Server side. What changes u made??, what you mean by utils-linux?

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

5 participants