Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
bash-logger logging to separate file with syslog-ng
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
saroir
n00b
n00b


Joined: 02 Nov 2004
Posts: 3
Location: Russia, Moscow

PostPosted: Thu Nov 03, 2005 7:27 pm    Post subject: bash-logger logging to separate file with syslog-ng Reply with quote

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
View user's profile Send private message
Simba
n00b
n00b


Joined: 08 Nov 2002
Posts: 60

PostPosted: Sat Nov 19, 2005 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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