Code Monkey home page Code Monkey logo

Comments (6)

skarnet avatar skarnet commented on August 25, 2024

I certainly missing something, but when using postfix with s6-socklog (using the s6-overlay syslogd addon), I end up having the date duplicated in every log lines. As far as I understood posfix doesn't log any date.

You're not missing anything, indeed there's date duplication. The thing is, the syslog() function (both in musl and glibc) prepends every log line with an ISO date, and it's not deactivatable or configurable. I had forgotten this, so I had made the syslogd-log service add a timestamp by default, but it is useless. I have removed the default timestamp in the current git, so you won't have to manually modify S6_LOGGING_SCRIPT once the next version is released.

Also, is there a way to add a server name in the log line (to be compatible with postfix log parser), to have something like

Aug 26 11:19:05 smtp postfix/postfix-script[25430]: refreshing the Postfix mail system

instead of

Aug 26 11:19:05 postfix/postfix-script[25430]: refreshing the Postfix mail system

Unfortunately, it's not possible. syslog() is a global service: it's impossible for syslogd to treat logs lines differently depending on what process sends them. With most syslog implementations, it is even impossible for syslogd to identify the process that sent a log line. If postfix sends a line starting with postfix/postfix-script, syslogd cannot rewrite it into smtp postfix/postfix-script, unless it prepends every log line with smtp .

from s6.

eburghar avatar eburghar commented on August 25, 2024

Thanks for the explanation.

I think that the hostname is part of the syslog protocol message and is normally received by s6-syslogd. I just thought that for whatever reason (configuration, simplification, ...), it didn't write it to the log line. It was the only reason I saw for the hostname not appearing in the log line as it appears with other syslogd daemon.

from s6.

skarnet avatar skarnet commented on August 25, 2024

So smtp is your hostname?
It is possible that other implementations of syslogd are configured by default to prepend their log lines with the hostname, but that would surprise me because apparently the hostname is inserted after the date. The syslog() protocol definitely does not include the hostname as part of the line. That's weird.

from s6.

eburghar avatar eburghar commented on August 25, 2024

Sorry I misread the rfc. I quickly look at socklog code and it just parses pri in non raw mode and forward the remaining of the syslog string.

So it's postfix which is sending the date and the hostname ? I don't understand why it writes correctly the hostname with postfix maillog_file parameter and not in syslog mode with socklog.

from s6.

skarnet avatar skarnet commented on August 25, 2024

Yes, that's what I've been saying. If there's a discrepancy, it's client-side. What you see in the syslogd logs is exactly what the client sent, except for the date.

from s6.

eburghar avatar eburghar commented on August 25, 2024

Thanks for your time and valuable explanations !

from s6.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.