1) How can we redirect the log stream from stdin to, for example lnav? Currently, I use bash | (pipe), but I would like to hear if there is a better way to do it - the pipe buffer flow is too fast for lnav to process and format it properly – any ideas/solutons here?

I don't know how to set a bridge (I don't want to write/read to the filesystem) between log and any other shell process without pipe in bash directly.

2) How can I properly use the stream from log stream to put the JSON direct into mongodb?

log stream --style=json output makes it a lot easier to hack some awesome node analytical/statistical or visual parsers.

log stream --style=syslog --level=info can make one dizzy, with --predicate you can narrow it down to more readable flow:

log stream --style syslog --predicate \ 'senderImagePath contains[cd] "TimeMachine"' --info

The API is a good step forward – but I'd like to have more transition time with syslog until I forget about it and the uhmmmm the new memory persistent log since 10.12.1 public beta is not entirely to my liking since I simply don't get any new log files in /private/var/log (can also be my config error/mistake though)

update 1https://developer.apple.com/reference/os/1891852-logging#1682426

  • For others who haven't used lnav: lnav.org – bleater Mar 5 '18 at 3:41
  • lnav needs some file/stream as input. Trying to pipe/redirect "log stream" to lnav is a very bad idea, since lnav cant keep up with the amount log stream spits out. Don't take my word though and try it yourself ;-) I redirect log stream into mongodb by and then skim through the database later, lnav included. the log stream can spit .json formatted data so you can easily pipe it into something more usable, or hack a syslog redirection, just be careful since it can literally overflow you with data when using --level=debug – PJJ Jan 29 at 23:41

You must log in to answer this question.

Browse other questions tagged .