You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using svlogd which copies when rotating [1], there doesn't seem to be any hooks to restart remote_syslog so I'd like to be able to replace svlogd with remote_syslog
Thanks for the extra info, that helps a lot. I can see a couple possibilities here:
restart remote_syslog2, by using the PID file it writes (ie, what the restart handlers in these init files do -- more on this method).
use svlogd's u config option and have it send to to Papertrail
I'd say add HUP handling to remote_syslog, except that I don't see any evidence that svlogd has an easier way to send a HUP than it does to simply restart
If remote_syslog2 supported piped input, what would handle the other tasks that svlogd does in your environment, like rotation? If you don't need or want rotation, it seems like the u flag or piping to logger would both work equally well, but I may be missing constraints.
Is UDP the standard way to transmit logs to papertrail? I'd much prefer to use TCP rather than UDP, also I'm not sure that TLS is supported.
If remote_syslog were to take input from stdin (eg a pipe) I think it should output everything it receives (configurable perhaps) untouched to stdout (even if it couldn't send the log messages for any reason, maybe errors output to a separate remote_syslog log file).
Here's an example using the command I currently run
By having remote_syslog handle the messages before they get to the logfile all the rotation issues/other complications go away, additionally there's no remote_syslog process to be managed, it becomes a part of the process that's being logged.
I wrote a python script to do this however it's not a viable option as each new log line makes a new TLS connection which takes around 0.7s, so it's impractical.
To use an existing connection for multiple messages you have to have some kind of daemon which keeps the connection, I have ideas for how it could work but it's a far more complex solution than I initially thought.
@j0hnsmith agreed all around. UDP solves that (and is supported ~specifically to solve that problem of non-blocking stateless "fire and forget" logging), but it sounds like you don't want to use UDP for other reasons.
I think we'd consider a pull request to remote_syslog which accepts data from a pipe and/or outputs it, but that's a much bigger undertaking and I think most implementors prefer to keep a local copy of logs anyway.
It's sort of tangential to this, but the sv* tool set has an unusual enough set of features and preferred implementation that it leads to wanting this. That came up once before and it convinced me I'd be better served by a different init structure, even aside from this change.
Activity
troy commentedon Dec 11, 2014
We considered that too, but check out
logger. It's available with most OSes that have GNU or BSD tools installed, and does exactly this.If
loggerdoesn't do it, can you explain more about your environment, what you'd pipe, and why? Thanks, too!troy commentedon Dec 11, 2014
Oh, here's the manpage for logger. Basically it can read from a pipe or file and send to the local syslog, which sends to Papertrail.
j0hnsmith commentedon Dec 11, 2014
I'm using svlogd which copies when rotating [1], there doesn't seem to be any hooks to restart remote_syslog so I'd like to be able to replace svlogd with remote_syslog
http://smarden.org/runit/svlogd.8.html#sect4
troy commentedon Dec 11, 2014
Thanks for the extra info, that helps a lot. I can see a couple possibilities here:
uconfig option and have it send to to Papertrailsvlogdhas an easier way to send aHUPthan it does to simply restartIf remote_syslog2 supported piped input, what would handle the other tasks that
svlogddoes in your environment, like rotation? If you don't need or want rotation, it seems like theuflag or piping tologgerwould both work equally well, but I may be missing constraints.j0hnsmith commentedon Dec 12, 2014
Is UDP the standard way to transmit logs to papertrail? I'd much prefer to use TCP rather than UDP, also I'm not sure that TLS is supported.
If remote_syslog were to take input from stdin (eg a pipe) I think it should output everything it receives (configurable perhaps) untouched to stdout (even if it couldn't send the log messages for any reason, maybe errors output to a separate remote_syslog log file).
Here's an example using the command I currently run
It would be cool if I could do
By having remote_syslog handle the messages before they get to the logfile all the rotation issues/other complications go away, additionally there's no remote_syslog process to be managed, it becomes a part of the process that's being logged.
j0hnsmith commentedon Dec 19, 2014
I wrote a python script to do this however it's not a viable option as each new log line makes a new TLS connection which takes around 0.7s, so it's impractical.
To use an existing connection for multiple messages you have to have some kind of daemon which keeps the connection, I have ideas for how it could work but it's a far more complex solution than I initially thought.
troy commentedon Dec 19, 2014
@j0hnsmith agreed all around. UDP solves that (and is supported ~specifically to solve that problem of non-blocking stateless "fire and forget" logging), but it sounds like you don't want to use UDP for other reasons.
I think we'd consider a pull request to remote_syslog which accepts data from a pipe and/or outputs it, but that's a much bigger undertaking and I think most implementors prefer to keep a local copy of logs anyway.
It's sort of tangential to this, but the
sv*tool set has an unusual enough set of features and preferred implementation that it leads to wanting this. That came up once before and it convinced me I'd be better served by a different init structure, even aside from this change.