| View previous topic :: View next topic |
| Author |
Message |
saroir n00b


Joined: 02 Nov 2004 Posts: 3 Location: Russia, Moscow
|
Posted: Thu Nov 03, 2005 7:27 pm Post subject: bash-logger logging to separate file with syslog-ng |
|
|
small tip , maybe it'll be useful for smb.
i needed to log everything typed in bash to syslog , so i've found bash-logger for bash
but it logs ( almost floods )everything to /var/log/messages , syslog-ng displays the latter on /dev/tty12
i've done lil research in /usr/portage/app-shells/bash/files/bash-3.0-bash-logger.patch
syslog(LOG_LOCAL5 | LOG_INFO, "HISTORY: PID=%d UID=%d %s",
it means that bash logs for info and local5 facilities
short , to log typed commands in bash to a separate file you need to change/add following to /etc/syslog-ng/syslog-ng.conf
| Code: |
...
#define destinations
destination bash { file("/var/log/bash"); };
...
#create filters
filter f_bash { facility(local5); };
filter f_messages { level(info..warn)
and not facility(auth, authpriv, mail, news, local5); };
# connect filter and destination
log { source(src); filter(f_bash); destination(bash);};
|
|
|
| Back to top |
|
 |
Simba n00b


Joined: 08 Nov 2002 Posts: 60
|
Posted: Sat Nov 19, 2005 9:06 am Post subject: |
|
|
and I have like this:
| Code: |
destination bash { file("/var/log/bash.log"); };
filter f_bash { match("^.?bash:.*"); };
filter f_notbash { not match("^.?bash:.*"); };
log { source(src); filter(f_messages); filter(f_notbash); destination(messages); };
log { source(src); filter(f_bash); destination(bash); };
|
Simba |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|