Persist OSLog in "Analytics & Improvements"

Hello Apple support,

We are trying to figure out how to persist the activity logs and retrieve it. It seems the obvious place to find them is "Analytics & Improvements" in settings.

  1. How are the .ips log generated? (OSLog?)
  2. What are the conditions for the iOS to store the logs?

We are aware of this post, but no info on the storage of logs

Answered by DTS Engineer in 816606022

No worries. I can remove tags. I just wanted to make sure we’re talking about the same stuff (-:

Coming back to your original questions, be aware that crash reports and the system log are different things. They’re only related in the sense that, when the system generates a crash report, info about that process is logged to the system log.

As to how these are implemented, be aware we’re talking about implementation details here, not APIs. As such, anything I say is subject to change.

Currently crash reports are recorded in JSON format as .ips files. These are standalone files, saved on the device’s data volume. Your app does not have access to them.

The system log is much more complex. In Your Friend the System Log you’ll find a reference to a WWDC 2016 session that discusses how it works in detail. Sadly, that video is no longer available from Apple, but you might be able to use that link to find adjunct info from other place’s on the ’net.

In short:

  • The system log has complex logic to filter out log entries on the client side.

  • If the client decides to log something, it writes it to a memory buffer that’s shared with the logging daemon.

  • The logging daemon has complex logic to decide whether a log entry should be written to disk, that is, persisted.

  • If it is, the logging daemon does that in chunks, compressing each chunk before writing it.

  • The logging daemon will prevent the log from growing without bound by expiring log entries.

None of this is visible to you. There are APIs to inspect the system log, albeit with significant caveats, especially on iOS. Your Friend the System Log has the details.

If you have follow-up questions, post them in a reply and I’ll see what I can do to help out.

Share and Enjoy

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

You added the Device Activity tag to your thread. That’s specific to the DeviceActivity framework, part of the whole Screen Time / FamilyControls fun. Is that a key concern here? Or were you just using device activity in the general sense?

Share and Enjoy

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

ops, no, I'm not interested in the deviceActivity framework. Looks like I can't remove tags neither.

I want to use the Logger/OSLog framework to write logs to disk. So that I can understand the performance issue with the app.

No worries. I can remove tags. I just wanted to make sure we’re talking about the same stuff (-:

Coming back to your original questions, be aware that crash reports and the system log are different things. They’re only related in the sense that, when the system generates a crash report, info about that process is logged to the system log.

As to how these are implemented, be aware we’re talking about implementation details here, not APIs. As such, anything I say is subject to change.

Currently crash reports are recorded in JSON format as .ips files. These are standalone files, saved on the device’s data volume. Your app does not have access to them.

The system log is much more complex. In Your Friend the System Log you’ll find a reference to a WWDC 2016 session that discusses how it works in detail. Sadly, that video is no longer available from Apple, but you might be able to use that link to find adjunct info from other place’s on the ’net.

In short:

  • The system log has complex logic to filter out log entries on the client side.

  • If the client decides to log something, it writes it to a memory buffer that’s shared with the logging daemon.

  • The logging daemon has complex logic to decide whether a log entry should be written to disk, that is, persisted.

  • If it is, the logging daemon does that in chunks, compressing each chunk before writing it.

  • The logging daemon will prevent the log from growing without bound by expiring log entries.

None of this is visible to you. There are APIs to inspect the system log, albeit with significant caveats, especially on iOS. Your Friend the System Log has the details.

If you have follow-up questions, post them in a reply and I’ll see what I can do to help out.

Share and Enjoy

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

From the looks of it, I need to implement the following. Apple don't have the facility for the items below.

  • use the Logger api for logging and writing to the system log
  • use OSLogStore on a separate thread to write to disk in my app space
  • collect the log and analyze the performance issue
Persist OSLog in "Analytics & Improvements"
 
 
Q