I would like to start a process and monitor its LOG_DEBUG syslog messages.

I know that I can change the filter of an already running process with syslog -c process (and then monitor its messages with syslog -w -k Sender process), but that requires the process already to be running and furthermore fills up logfiles with messages that I only need temporarily.

Is my only option to change the running configuration with syslog -config, then later restore the configuration once I have read the messages I want? Surely there is a "better" way.

  • Not completely sure what you're asking for; if it's a temporary solution, you already included it in your question (wouldn't be to complicated to put in a .sh script) if it's a more long-term thing you should configure /etc/asl.conf with something like [= Sender exampleApp] [< Level Error] file exampleApp.log. In any case if you want to log something, you need to store it somewhere; whether it's a file or "only" printed on your screen, it's using more or less the same resources. – Asmus Dec 18 '14 at 17:24

Using the tail command in Terminal.app will follow a log file and print out in real time whats being written to just that log file.

tail -f /path/to/your/log/file.log

If your process has a common name that shows in every log file, like com.my.process you can tail the file and grep out for that keyword/process.

tail -f /var/log/system.log | grep "com.my.process"

tail command

  • I think this rather misses the point of my question. I'm trying to avoid (a) writing these messages to the filesystem; and (b) making anything more than an ephemeral change to syslog's configuration. Use of tail in this fashion necessitates both. – eggyal Dec 18 '14 at 13:42

You must log in to answer this question.

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