Console.app and Find/Search/Filter

The behavior in the log app is a little different than normal...


When using Find from the Edit menu I am sent to the Search field. If I enter text in the Search field the log is filtered (this is text in a file not Finder files).


How do I get Console.app to just show the text I am looking for in context of the entire log?


I have tried to select the text and then remove the search term and select Command+J but the originally selected text doesn't remain selected after clearing the search field

iMac 27″

Posted on May 23, 2023 2:20 PM

Reply
Question marked as Top-ranking reply

Posted on May 23, 2023 3:48 PM

> I have a log file that is backed up. I am just trying to find the spot in the log where something happened. I guess I will use something else.



grep and Terminal.app is your friend here.


grep will search a file for a text string and return all matching lines. For this it needs two arguments - the string to look for, and the file to search in, so open Terminal.app and run something like:


grep EVENT /path/to/some.log


this will look in the file /path/to/some.log and find all matches of the string 'EVENT'.


There are also many switches you can use with grep to show the surrounding data - for example, the -A switch will show a set number of lines after the match (useful if you want to see the events that happened immediately after the search line):


grep -A 5 EVENT /path/to/some.log


Does that help?

5 replies
Question marked as Top-ranking reply

May 23, 2023 3:48 PM in response to johnnyjackhammer

> I have a log file that is backed up. I am just trying to find the spot in the log where something happened. I guess I will use something else.



grep and Terminal.app is your friend here.


grep will search a file for a text string and return all matching lines. For this it needs two arguments - the string to look for, and the file to search in, so open Terminal.app and run something like:


grep EVENT /path/to/some.log


this will look in the file /path/to/some.log and find all matches of the string 'EVENT'.


There are also many switches you can use with grep to show the surrounding data - for example, the -A switch will show a set number of lines after the match (useful if you want to see the events that happened immediately after the search line):


grep -A 5 EVENT /path/to/some.log


Does that help?

May 23, 2023 4:18 PM in response to johnnyjackhammer

johnnyjackhammer wrote:

I have a log file that is backed up. I am just trying to find the spot in the log where something happened. I guess I will use something else.

I was just searching for a replacement when you replied. lnav appears to be decent, and I haven't used it yet.

I'm not sure what you mean by "log file". Perhaps you should be more specific about exactly what you are doing.


Here's the problem. Apple devices really don't have "log files" in that sense any more. There are still a few, ancient legacy log files, but ignore those. They don't have any meaningful data. When you run Console and start "streaming", you are looking at data from Apple's new "unified logging system". There are no traditional log files in this new system. Console is useless, and in many cases, worse that useless. But it only shows you data from when you clicked on the "start streaming" button. There is a command line tool, named "log", that can show you all of the log data. It can be extremely difficult to use. You'll have to learn the custom query language for it. Plus, if you haven't already installed a special configuration profile, much of your log data will be redacted.


That's why I asked you first what you were trying to accomplish. In many cases, people come here to the forums and ask a question only when they are already well within a pointless rabbit hole. They've really lost the point by that point. But when modern Mac logging is concerned, the rabbit hole is more of a city block-sized sinkhole. To be blunt, you'll never find that spot. Once you get down deep enough, you realize that there are literally hundreds of log entires across the entire system posted every second.


It really doesn't matter what you are trying to accomplish, Console and the logging system will NOT get you there.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Console.app and Find/Search/Filter

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.