3

I can add a message to the macos system log via the command line on Sierra or later as follows:

logger -t "TestTag" "testing 1 2 3"

How do I find all messages that have been tagged with TestTag?

I can use log stream but I can't find how to filter for that tag. Any other command line solution would be fine too.

7
  • What MacOS version? – Prado Aug 9 '19 at 17:24
  • 1
    I tried it on MacOS Catalina, 'Tags' does not shows on log stream, just the message. Also not showing on graphical Console.app. But the message shows on both, and I know how to filter it using 'log stream' but this would not be the correct answer since you asked for the 'tag' filter. That is why I asked for your MacOS version, because 'tag' is invisible anywhere on my system version – Prado Aug 9 '19 at 18:23
  • @Prado I'm looking for >= Sierra – Les Hazlewood Aug 9 '19 at 18:59
  • 2
    I think the closer it can get is filtering for 'logger' process: log stream --info --predicate 'process == "logger"', it looks like 'tag' is being completely ignored by the Unified Log system. But if you try logger -is -t "TestTag" "testing 1 2 3" (using -is parameter) the tag is shown on terminal, but still not logged to database. Log database always logs it as [logger] message – Prado Aug 9 '19 at 20:10
  • 2
    @Prado that's a shame - that means that tagging is effectively broken and useless. I wonder why it exists? – Les Hazlewood Aug 12 '19 at 22:03

You must log in to answer this question.

Browse other questions tagged .