No API to query os_log, is that correct?

I couldn't find anything too recent, but everything seems to say that no, asl_search-like APIs are non-existent for os_log. And the source code for log isn't available so I can't see how it does it...

Answered by DTS Engineer in 738631022

No API to query os_log, is that correct?

No, that’s not correct. The droid you’re looking for is the OSLog framework.

IMPORTANT This is available on non-Mac platforms but it has substantial limitations there. Your Friend the System Log goes into the details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

No API to query os_log, is that correct?

No, that’s not correct. The droid you’re looking for is the OSLog framework.

IMPORTANT This is available on non-Mac platforms but it has substantial limitations there. Your Friend the System Log goes into the details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I at this time only care about macOS. 😄

How can you stream using OSLog though? (Specifically, during diagnostics generation, I want to grab the log stream --info --debug --predicate 'subsystem == "us"' equivalent for a few seconds.) Using the enumerator seems to give me up to a point in time, but then it ends. There is OSLogEntryActivity but I'm not sure that's the right thing. And I can't find any examples of it.

The OSLog framework does not support streaming. Feel free to file an enhancement request for that. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I filed FB11861011 just now.

No API to query os_log, is that correct?
 
 
Q