Customize session handling
By default, Splunk MINT uses the initAndStartSessionWithAPIKey: and initAndStartSessionWithHECUrl: methods and the time zone of our servers to calculate the time a user's session begins. However, you can customize session handling if you need to.
- Note When you close a session, it does not impact any other feature of the Splunk MINT plugin. The plugin will continue working properly and record network information, handled exceptions, events, and any crash that might occur.
Use the following methods to start, close, and flush sessions:
- To explicitly start the session, use the startSession: method. (If a previous session was initialized less than one minute earlier, this call is ignored.)
- To close the active session, use the closeSession method.
- To manually flush all saved data, use the flush: method.
- To only send data over a WiFi connection, use the enableFlushOnlyOverWiFi: method.
The SDK sends data over the network in the following cases:
- When the app starts. The SDK sends a "hello" packet to update all of the real-time information that is displayed in the Splunk MINT dashboards, along with all of the information that was collected and saved from previous sessions.
- When you explicitly call the flush: method. The SDK sends all information that has been gathered and saved until that moment.
- When an unexpected runtime exception occurs and crashes your app. The SDK collects the crash information and writes it to disk, then the app terminates. The next time the app starts, it tries to send the information to Splunk MINT.
- When batched event data reaches 140KB. The MINT SDK saves events in batches up to 140KB per file. If there is network connectivity, the SDK sends the data. Otherwise, the SDK continues to save up to three files of event data. If there is still no network connectivity, the SDK deletes the first file and continues saving data.
If there are logged handled exceptions, custom events, or any network interception captured by Splunk MINT and you don't want to wait for another initAndStartSessionWithAPIKey use the flush: method to immediately send any logged requests to the Splunk server.
// Objective-C [[Mint sharedInstance] startSession]; [[Mint sharedInstance] closeSession]; [[Mint sharedInstance] enableFlushOnlyOverWiFi:YES]; [[Mint sharedInstance] flush];
// Swift Mint.sharedInstance().startSession() Mint.sharedInstance().closeSession() Mint.sharedInstance().enableFlushOnlyOverWiFi(true) Mint.sharedInstance().flush()
Add Splunk MINT to your iOS project
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (Legacy): 5.2.x
Feedback submitted, thanks!