Cannot get incremental logs from OSLogStore

Hello folks,

I would like to incrementally retrieve logs of my iOS App from the Unified Logging System using OSLogStore.

  1. First I initialize the store
  • store = try OSLogStore(scope: .currentProcessIdentifier)
  1. Second I set a position from which I want the logs using either :
  • position = store.position(timeIntervalSinceLatestBoot: 0) // to get the logs from the launch of the App
  • position = store.position(date: Date().addingTimeInterval(-10)) // to get the logs of the last 10 seconds
  1. Third I get the entries in the store from the position
  • store.getEntries(at: position)

Issue

Whatever the position I set using from OSLogStore:

  • position(timeIntervalSinceLatestBoot:)
  • position(date:)
  • position(timeIntervalSinceEnd:)

All the logs are retrieved. I cannot get only the subset requested by the timeframe I specified

Sample

A sample LogScreen that has 2 buttons is attached to the post

  • 1 to fetch logs since the last time they have been fetched
  • 1 to add a log

The code has been simplified to ease the comprehension of the case, please be indulgent to the shortcuts that have been taken.

References

https://developer.apple.com/documentation/oslog/oslogstore https://developer.apple.com/forums/thread/705868 https://developer.apple.com/videos/play/wwdc2023/10226/

Environment

XCode 15b7 iPhone 14 Pro / iOS 17

It sounds like you’re trying to report a bug; if so, it’s best do that in Feedback Assistant. See Bug Reporting: How and Why? for more on that process.

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"

Cannot get incremental logs from OSLogStore
 
 
Q