1 |
On 15.11.2009 13:45, Mick wrote: |
2 |
> On Saturday 14 November 2009 16:53:24 Alex Schuster wrote: |
3 |
>> I assume you are using logrotate, and have the /etc/logrotate.d/kernel |
4 |
>> file? I guess the 'compytruncate' is misspelled and should be |
5 |
>> 'copytruncate'. And 'endscript' is used after using 'prerotate' or |
6 |
>> 'postrotate', which you probably do not have. |
7 |
>> |
8 |
>> Something like that, I never used logrotate by myself. See the man page |
9 |
>> for more information. |
10 |
> |
11 |
> Hmm ... how do you keep your log files under control? |
12 |
|
13 |
Use time-based file names. For syslog-ng something like: |
14 |
|
15 |
destination mail { |
16 |
file("/var/log/mail/$YEAR/$MONTH/$DAY/$HOUR" |
17 |
template("$ISODATE $HOST $MSG\n") template_escape(no) |
18 |
owner("root") group("log") perm(0640) |
19 |
dir_owner("root") dir_group("log") |
20 |
dir_perm(02750) create_dirs(yes)); |
21 |
}; |
22 |
destination msgs { |
23 |
file("/var/log/msgs/$YEAR/$MONTH/$DAY/$HOUR" |
24 |
template("$ISODATE $HOST $MSG\n") template_escape(no) |
25 |
owner("root") group("log") perm(0640) |
26 |
dir_owner("root") dir_group("log") |
27 |
dir_perm(02750) create_dirs(yes)); |
28 |
}; |
29 |
|
30 |
source local { unix-dgram("/dev/log"); pipe("/proc/kmsg"); |
31 |
internal(); }; |
32 |
filter mail { facility(mail); }; |
33 |
filter notmail { not facility(mail); }; |
34 |
log { source(local); filter(mail); destination(mail); }; |
35 |
log { source(local); filter(notmail); destination(msgs); }; |
36 |
|
37 |
|
38 |
Important points: |
39 |
- "unix-dgram" is good |
40 |
- Use template() to determine the format |
41 |
- No need to logrotate with time based filenames. Hence, no need to |
42 |
"kill -HUP" the syslog daemon. No missed logs. |
43 |
- Easier to get the log files to a central server with time based |
44 |
filenames. |
45 |
- "log" group is for transfering the log files to a central server |
46 |
|
47 |
-- |
48 |
Eray |