Gentoo Archives: gentoo-user

From: Marcin Niskiewicz <mniskiewicz@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] syslog-ng +bash history
Date: Thu, 05 Feb 2009 08:31:11
Message-Id: b6373cd60902050031m43349040k455ff51f05b3eb65@mail.gmail.com
In Reply to: Re: [gentoo-user] syslog-ng +bash history by Yannick Mortier
1 2009/2/4 Yannick Mortier <mvmortier@××××××××××.com>
2
3 > 2009/2/4 Marcin Niskiewicz <mniskiewicz@×××××.com>:
4 > Hello Marcin!
5 > I imply that you already have done some modifications to your
6 > syslog-ng.conf as logging everything the user type on the console is
7 > not in the standard file that comes with gentoo.
8 >
9 > Basically syslog-ng has got sources and destinations. So you have to
10 > take a look at your syslog-ng.conf and find out the name of the
11 > sources and the name of the destination of the history.log file.
12 >
13 > Then you can simply add the following line (replace the variables
14 > accordingly)
15 >
16 > log { source([source that was previously used for debug]);
17 > source([source that was previously used for syslog]); source([source
18 > that was previously used for messages]); destination([destination of
19 > history.log]) };
20 >
21 > If all the sources give you the same messages or they are one and the
22 > same source just insert only this one. If your history.log file was
23 > not defined by now you can simply add it as a destination with
24 >
25 > destination [name] { file("[path-to-history.log]/history.log");}
26 >
27 > Also if there are other log lines that contain the sources and the
28 > destinations that you mentioned you have to remove them completely if
29 > they only contain this one source or just remove the source that
30 > delivers the history.
31 >
32 > Then syslog-ng should only log into history.log
33 >
34 > Greetings
35 >
36 >
37 > --
38 > Currently developing a browsergame...
39 > http://www.p-game.de
40 > Trade - Expand - Fight
41 >
42 > Follow me at twitter!
43 > http://twitter.com/moortier
44 >
45 >
46
47 As I can see I wrote my post unclearly ;)
48 I meant that in standard configuration (without any changes) everything
49 typed in console is written to those 3 files (debug , syslog, messages)
50 And I would like syslog not to log history in those 3 files.
51 So I made filter to route it to history.log
52 It works fine (it writes history to history.log) but still it writes it to
53 those 3 files (debug , syslog, messages) as well ...
54 so now everything I type is written to 4 files (debug , syslog, messages and
55 history.log) and I'd like it to be written only to 1 file.
56
57 I hope it's clear now ;)
58 regards
59
60
61 My STANDARD configuration (with my modifiication to route history to
62 history.log) looks like this:
63
64
65 # Copyright 2005 Gentoo Foundation
66 # Distributed under the terms of the GNU General Public License v2
67 # $Header:
68 /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.conf.gentoo.hardened,v
69 1.5 2007/10/30 17:16:15 solar Exp $
70
71 #
72 # Syslog-ng configuration file, compatible with default hardened
73 installations.
74 #
75
76 options {
77 chain_hostnames(off);
78 sync(0);
79 stats(43200);
80 };
81
82 source src { unix-stream("/dev/log"); internal(); };
83 source kernsrc { file("/proc/kmsg"); };
84
85 destination authlog { file("/var/log/auth.log"); };
86 destination syslog { file("/var/log/syslog"); };
87 destination cron { file("/var/log/cron.log"); };
88 destination daemon { file("/var/log/daemon.log"); };
89 destination kern { file("/var/log/kern.log"); file("/dev/tty12"); };
90 destination lpr { file("/var/log/lpr.log"); };
91 destination user { file("/var/log/user.log"); };
92 destination uucp { file("/var/log/uucp.log"); };
93 destination mail { file("/var/log/mail/mail.log"); };
94
95 destination avc { file("/var/log/avc.log"); };
96 destination audit { file("/var/log/audit.log"); };
97 destination pax { file("/var/log/pax.log"); };
98 destination grsec { file("/var/log/grsec.log"); };
99 destination historia { file("/var/log/history.log"); };
100
101 destination mailinfo { file("/var/log/mail/mail.info"); };
102 destination mailwarn { file("/var/log/mail/mail.warn"); };
103 destination mailerr { file("/var/log/mail/mail.err"); };
104
105 destination newscrit { file("/var/log/news/news.crit"); };
106 destination newserr { file("/var/log/news/news.err"); };
107 destination newsnotice { file("/var/log/news/news.notice"); };
108
109 destination debug { file("/var/log/debug"); };
110 destination messages { file("/var/log/messages"); };
111 destination console { usertty("root"); };
112 destination console_all { file("/dev/tty12"); };
113
114 destination xconsole { pipe("/dev/xconsole"); };
115
116 filter f_auth { facility(auth); };
117 filter f_authpriv { facility(auth, authpriv); };
118 filter f_syslog { not facility(authpriv, mail); };
119 filter f_cron { facility(cron); };
120 filter f_daemon { facility(daemon); };
121 filter f_kern { facility(kern); };
122 filter f_lpr { facility(lpr); };
123 filter f_mail { facility(mail); };
124 filter f_user { facility(user); };
125 filter f_uucp { facility(uucp); };
126 filter f_debug { not facility(auth, authpriv, news, mail); };
127 filter f_messages { level(info..warn)
128 and not facility(auth, authpriv, mail, news); };
129 filter f_emergency { level(emerg); };
130
131 filter f_info { level(info); };
132
133 filter f_notice { level(notice); };
134 filter f_warn { level(warn); };
135 filter f_crit { level(crit); };
136 filter f_err { level(err); };
137
138 filter f_avc { match(".*avc: .*"); };
139 filter f_audit { match("^audit.*") and not match(".*avc: .*"); };
140 filter f_pax { match("^PAX:.*"); };
141 filter f_grsec { match("^grsec:.*"); };
142 filter f_history { match(".*HISTORY*"); };
143
144 log { source(src); filter(f_authpriv); destination(authlog); };
145 log { source(src); filter(f_syslog); destination(syslog); };
146 log { source(src); filter(f_cron); destination(cron); };
147 log { source(src); filter(f_daemon); destination(daemon); };
148 log { source(kernsrc); filter(f_kern); destination(kern); };
149 log { source(src); filter(f_lpr); destination(lpr); };
150 log { source(src); filter(f_mail); destination(mail); };
151 log { source(src); filter(f_user); destination(user); };
152 log { source(src); filter(f_history); destination(history); };
153 log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };
154 log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); };
155 log { source(src); filter(f_mail); filter(f_err); destination(mailerr); };
156 log { source(src); filter(f_debug); destination(debug); };
157 log { source(src); filter(f_messages); destination(messages); };
158 log { source(src); filter(f_emergency); destination(console); };

Replies

Subject Author
Re: [gentoo-user] syslog-ng +bash history Willie Wong <wwong@×××××××××.EDU>