Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a Launch Daemon running, happily logging to a couple of files specified using the Standard(Error|Out)Path entries in the property list file.

Now, the problem is that the particular program that is running doesn't include a time stamp when logging messages. Consequently, the log files show a long list of otherwise helpful messages, logged sometime between now and whenever.

Is there any way to somehow include the time stamp to these messages? For example, is there an option that I could set somewhere, or a program that I could route these messages through (which would be trivial to write, but how would this routing work)?

share|improve this question
Depending on the frequency of log messages and the buffering applied to log writes, a simple script to write a time stamp into the log files every minute might be enough. –  patrix Jun 3 '12 at 20:07
Yeah, that's how I was doing it in the meantime. Thanks, matrix! Other than that, I was looking for a UNIX-y thing where you can write to a script as if to a file, but letting the script handle the input instead. –  Bastiaan van de Weerd Jun 7 '12 at 10:00
For future reference, it seems like this is possible using a named pipe, which can be created as a file-like object in the file system using the mkfifo mypipe command. Once created, read from it with eg. cat < path/to/mypipe, and write to it (try in another terminal window) with eg. echo 'Foo!' > path/to/mypipe. (NB. Auto-corrupt botched up my thank you in the previous comment. Sorry about that, patrix...) –  Bastiaan van de Weerd Jun 7 '12 at 20:52
Also, instead of using the named pipe, the LaunchDaemon plist program can run complex shell commands using bash -c [shell command]. This command can contain redirection, piping, and everything. Consequently, I was able to pipe the first program's output through a script that added time stamps. (Answer found in this other question.) –  Bastiaan van de Weerd Jun 8 '12 at 10:50

Your Answer


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

Browse other questions tagged or ask your own question.