On Saturday 22 August 2009, Jarry wrote:
> Hi,
> I have a log-server (syslog-ng) collecting logs from my servers.
> Everything works for standard logs: clients forward them to server
> where they are filtered (based on facility or application) and
> splitted into a few files (for each client).
>
> The problem is with portage logs: I can not find any pattern
> I could use to filter them out. For example, this is small part
> of /var/log/emerge.log:
>
> 1250923552: *** emerge sync
> 1250923552: === sync
> 1250923552: >>> Starting rsync with rsync://140.211.166.165/gentoo-portage
> 1250923665: === Sync completed with rsync://140.211.166.165/gentoo-portage
> 1250923666: *** terminating.
> 1250923760: Started emerge on: Aug 22, 2009 06:49:20
> 1250923760: *** emerge depclean
> 1250923760: >>> depclean
> ...
>
> Can I somehow force portage to write all its logs (summary.log,
> emerge-fetch.log, emerge.log) in standard syslog format RFC-3164?
> I mean with all that stuff like priority (facility), header
> (timestamp, hostname), application, etc. Even better if portage
> could write its logs to /dev/log...
This came up on the Gentoo portage forum recently. What I do is this:
1. In /etc/conf.d/local.start add a line
tail -F /var/log/emerge.log | awk '{$1="";print | "logger -t emerge -p
local5.info"}' &
2. In /etc/syslog-ng/syslog-ng.conf add lines to the effect of:
destination emerge { file("/var/log/emerge"); };
filter f_emerge { program(emerge); };
filter f_messages { level(info..emerg)
and not facility(auth, authpriv, mail, news, cron, local0, local6)
and not program(emerge); };
log { source(src); filter(f_emerge); destination(emerge); };
Restart syslog-ng and there you go. :)
HTH
-Robin
--
----------------------------------------------------------------------
Robin Atwood.
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
----------------------------------------------------------------------