TestFairy can integrate with Splunk to provide better insights into your mobile apps. This document explains how to export the app logs from TestFairy and import them into your Splunk installation.

Exporting logs

Use the TestFairy Fetch Session Tool tool to download log files for a specific project.

npm install -g --link git+https://github.com/testfairy/testfairy-fetch-sessions.git

testfairy-fetch-sessions --endpoint "acme.testfairy.com" --user "john@example.com" --api-key "0123456789abcdef" --project-id=1000 --logs

The logs are downloaded to a folder named testfairy-sessions with a directory structure as follows:

Alt

Note that the directory which contains the session.log file is also the session identifier. You can use this value to set the Host value later on.

Importing logs into Splunk

In your Splunk forwarder, under the settings menu, select Add Data:

Alt

Select the Monitor option:

Alt

Select Files & Directories:

Alt

With Files & Directories selected, browse to the directory where the log files were downloaded. It's best to point to the top-level testfairy-sessions incase you have multiple projects that you'd like to monitor.

Alt

After clicking Next, on the Input Settings page, set the Host using the Segment in path. Use the directory segment which contains the session.log file.

Alt

This will help you search and create search queries based on a specific session.

Create a query where the host=<session id> to see logs related to a given session.

Alt

Last updated on 2023-03-23