21.02.2014 12:48, Alan McKinnon пишет:
On 21/02/2014 09:03, Yuri K. Shatroff wrote:
Your idea instantly fails as the rc-service author has no idea of what
you defined ${SERVICE} to be and no way to determine what it is now.

Yes, the rc-service author does not have any idea because he is not
requested to.
${SERVICE} obviously comes from `rc-service status ${SERVICE}` .
The result (e.g. tail -n {$LINES} ${SERVICE}.log) is achieved by:
1. putting LINES= in /etc/conf.d/${SERVICE}
2. setting up ${SERVICE}.log with syslog. (or putting LOGFILE=... and
doing `tail -n ${LINES} ${LOGFILE}, or even LAST_LOG_CMD=`mysql -qe
'SELECT ... FROM log.log ORDER BY date DESC LIMIT ${LINES}'`, or
*whatever*)
3. adding this `tail -n ...` or whatever call to the init script .
4. voila.

If you feel I'm again entirely wrong please point out why.


The faults with your comments are many, and I'm not going to detail them
as that's not my job. I'm going to let you figure it out for yourself in
production why your entire approach is wrong, and simply leave you with
this:

You violate DRY.

For an example showing the general possibility to do this, I don't violate anything. One could easily grep a syslog config , or do the opposite (a syslog config generator from service configs), whatever. Of course I didn't write a complete logging-aware init scripts system because it's also not my job. But if it were, I'm pretty sure it's doable under SysV/BSD init in compliance with DRY and ease-of-use for admins. I'm sorry I couldn't convince you of that.

You expect the sysadmin to know they must make changes in a restart
config file when they tweak the syslogger so that somehow the init
script continues to get it right. Trust me, sysadmins are not going to
remember to do that, because expecting them to is off the wall crazy.

I repeat what I and Canek said earlier:

You've never actually DONE any of this in real life, right?

What exactly?
No, I didn't tweak any init system to print the last N log entries for a service. No, because I don't need it and never did. I *did* set up logging to a remote DB on SunOS and FreeBSD. But actually you're digressing and just going personal, because the question wasn't *how to setup logging* but *the possibility* of such a modification that *prints the last N log entries* in the service status cmd.

--
Regards,
Yuri K. Shatroff

Reply via email to