Ask Different is a question and answer site for power users of Apple hardware and software. 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

I want to exclude some firewall notices and certain benign error messages from the system logs.

They occur every few seconds and make it hard to find real problems, especially when the files get rotated away.

man syslog.conf does not mention string pattern matching like it does on Linux. Can Apple's daemon do it? Are there other options?

share|improve this question

The command grep -v allows filtering out a term or regex from the input. You can use a pipe (|) to combine multiple grep -v commands.

Example: grep -v firewall /var/log/system.log | grep -v imagent | grep -v mdworker

The first grep command in this example operates on the file contents; the subsequent grep commands operate on the output of the previous grep command.

grep is located at /usr/bin/grep on my Lion system. For more information on using grep, read the man page with the command man 1 grep or just man grep.

Edit: Command line can be shortened to

grep -v 'firewall\|imagent\|mdworker' /var/log/system.log
share|improve this answer
That doesn't help against log rotation, and while there is zgrep I'd prefer to use Also the disk activity due to logging prevents the computer from going to sleep. – Tobias Dec 12 '11 at 22:48
grep is context-aware, and will use gzip decompression automatically if necessary. Try grep -v 'firewall\|imagent\|mdworker' /var/log/system.log*? If for some strange reason it doesn't, change grep to zgrep. – Jason Salaz Jan 12 '12 at 8:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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