Is there an easy way to prevent the logging of commands run into syslog as post-shell expansion ?

I.e log a command of "ls *.log" as just that, rather than "ls a.log b.log c.log d.log" It makes rather a mess of the log files.

link|improve this question

64% accept rate
Glob expansion is one of the first things the shell does. How are you doing the logging? – Dennis Williamson Dec 17 '10 at 20:06
feedback

1 Answer

up vote 1 down vote accepted

not sure what you're trying to do but you can just do : logger "ls *.log", maybe explain it better?

//edit how to redirect sudo output.

$ visudo 
# then set :
Defaults !syslog
Defaults logfile=/var/lot/sudo.log 
link|improve this answer
Currently logging all commands run as root user. Some of the log lines are really long, where a user has performed a command with a shell expansion and it's been logged after that. e.g ls *.jpg in a directory with 2000 files, or such (as an example). – Sirex Dec 15 '10 at 10:01
Aaah as with sudo, no that's not possible, however you can redirect the log to a different file that way your main log won't get polluted. – OneOfOne Dec 15 '10 at 10:10
not always using sudo for the root user, logging in directly. I'll look into doing it for sudo though, thanks! – Sirex Dec 15 '10 at 10:19
I'm 100% sure you can redirect the commands using syslogd's config file but I have never used it, I've been using rsyslog. – OneOfOne Dec 15 '10 at 15:44
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.