Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
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 
share|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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .