1 |
21.02.2014 12:48, Alan McKinnon пишет: |
2 |
> On 21/02/2014 09:03, Yuri K. Shatroff wrote: |
3 |
>>> Your idea instantly fails as the rc-service author has no idea of what |
4 |
>>> you defined ${SERVICE} to be and no way to determine what it is now. |
5 |
>> |
6 |
>> Yes, the rc-service author does not have any idea because he is not |
7 |
>> requested to. |
8 |
>> ${SERVICE} obviously comes from `rc-service status ${SERVICE}` . |
9 |
>> The result (e.g. tail -n {$LINES} ${SERVICE}.log) is achieved by: |
10 |
>> 1. putting LINES= in /etc/conf.d/${SERVICE} |
11 |
>> 2. setting up ${SERVICE}.log with syslog. (or putting LOGFILE=... and |
12 |
>> doing `tail -n ${LINES} ${LOGFILE}, or even LAST_LOG_CMD=`mysql -qe |
13 |
>> 'SELECT ... FROM log.log ORDER BY date DESC LIMIT ${LINES}'`, or |
14 |
>> *whatever*) |
15 |
>> 3. adding this `tail -n ...` or whatever call to the init script . |
16 |
>> 4. voila. |
17 |
>> |
18 |
>> If you feel I'm again entirely wrong please point out why. |
19 |
> |
20 |
> |
21 |
> The faults with your comments are many, and I'm not going to detail them |
22 |
> as that's not my job. I'm going to let you figure it out for yourself in |
23 |
> production why your entire approach is wrong, and simply leave you with |
24 |
> this: |
25 |
> |
26 |
> You violate DRY. |
27 |
|
28 |
For an example showing the general possibility to do this, I don't |
29 |
violate anything. One could easily grep a syslog config , or do the |
30 |
opposite (a syslog config generator from service configs), whatever. Of |
31 |
course I didn't write a complete logging-aware init scripts system |
32 |
because it's also not my job. But if it were, I'm pretty sure it's |
33 |
doable under SysV/BSD init in compliance with DRY and ease-of-use for |
34 |
admins. I'm sorry I couldn't convince you of that. |
35 |
|
36 |
> You expect the sysadmin to know they must make changes in a restart |
37 |
> config file when they tweak the syslogger so that somehow the init |
38 |
> script continues to get it right. Trust me, sysadmins are not going to |
39 |
> remember to do that, because expecting them to is off the wall crazy. |
40 |
> |
41 |
> I repeat what I and Canek said earlier: |
42 |
> |
43 |
> You've never actually DONE any of this in real life, right? |
44 |
|
45 |
What exactly? |
46 |
No, I didn't tweak any init system to print the last N log entries for a |
47 |
service. No, because I don't need it and never did. |
48 |
I *did* set up logging to a remote DB on SunOS and FreeBSD. But actually |
49 |
you're digressing and just going personal, because the question wasn't |
50 |
*how to setup logging* but *the possibility* of such a modification that |
51 |
*prints the last N log entries* in the service status cmd. |
52 |
|
53 |
-- |
54 |
Regards, |
55 |
Yuri K. Shatroff |