1 |
On Saturday 22 August 2009, Jarry wrote: |
2 |
> Hi, |
3 |
> I have a log-server (syslog-ng) collecting logs from my servers. |
4 |
> Everything works for standard logs: clients forward them to server |
5 |
> where they are filtered (based on facility or application) and |
6 |
> splitted into a few files (for each client). |
7 |
> |
8 |
> The problem is with portage logs: I can not find any pattern |
9 |
> I could use to filter them out. For example, this is small part |
10 |
> of /var/log/emerge.log: |
11 |
> |
12 |
> 1250923552: *** emerge sync |
13 |
> 1250923552: === sync |
14 |
> 1250923552: >>> Starting rsync with rsync://140.211.166.165/gentoo-portage |
15 |
> 1250923665: === Sync completed with rsync://140.211.166.165/gentoo-portage |
16 |
> 1250923666: *** terminating. |
17 |
> 1250923760: Started emerge on: Aug 22, 2009 06:49:20 |
18 |
> 1250923760: *** emerge depclean |
19 |
> 1250923760: >>> depclean |
20 |
> ... |
21 |
> |
22 |
> Can I somehow force portage to write all its logs (summary.log, |
23 |
> emerge-fetch.log, emerge.log) in standard syslog format RFC-3164? |
24 |
> I mean with all that stuff like priority (facility), header |
25 |
> (timestamp, hostname), application, etc. Even better if portage |
26 |
> could write its logs to /dev/log... |
27 |
|
28 |
This came up on the Gentoo portage forum recently. What I do is this: |
29 |
|
30 |
1. In /etc/conf.d/local.start add a line |
31 |
tail -F /var/log/emerge.log | awk '{$1="";print | "logger -t emerge -p |
32 |
local5.info"}' & |
33 |
|
34 |
2. In /etc/syslog-ng/syslog-ng.conf add lines to the effect of: |
35 |
|
36 |
destination emerge { file("/var/log/emerge"); }; |
37 |
filter f_emerge { program(emerge); }; |
38 |
|
39 |
filter f_messages { level(info..emerg) |
40 |
and not facility(auth, authpriv, mail, news, cron, local0, local6) |
41 |
and not program(emerge); }; |
42 |
|
43 |
log { source(src); filter(f_emerge); destination(emerge); }; |
44 |
|
45 |
Restart syslog-ng and there you go. :) |
46 |
|
47 |
HTH |
48 |
-Robin |
49 |
-- |
50 |
---------------------------------------------------------------------- |
51 |
Robin Atwood. |
52 |
|
53 |
"Ship me somewheres east of Suez, where the best is like the worst, |
54 |
Where there ain't no Ten Commandments an' a man can raise a thirst" |
55 |
from "Mandalay" by Rudyard Kipling |
56 |
---------------------------------------------------------------------- |