-
Download trip_tracker.spl.
-
In Splunk, click on the
Apps
dropdown menu (top left) >Manage Apps
>Install app from file
(top right). -
Upload the downloaded
trip_tracker.spl
file.
-
In the top right go to
Settings
>Data Inputs
>HTTP Event Collector
>Global Settings
. -
Set "All Tokens" to
Enabled
, uncheck "Enable SSL", and ensure that "HTTP Port Number" is set to8088
. ClickSave
. -
Click
New Token
and on the next page, enter a name for the input in the corresponding box (e.g.TripTracker
). ClickNext
. -
In the "Select Allowed Indexes" section, select
main
. ClickReview
>Submit
. -
Copy/save the HEC token that should now be displayed. This will be used by the Python script we will run later.
-
Download the Geo Tracker - GPS tracker app and record some trips.
-
Once a trip is recorded, export the trip files (from the sidebar on the left) in GPX format. Copy that file onto your computer. (Or, alternatively, setup Termux to run Python scripts right from your phone.)
- Download parse_gpx.py. Edit line 64 and replace SPLUNK_IP and HEC_TOKEN with the IP address of your Splunk instance and the HEC token you created earlier.
parseXML(new_file, 'SPLUNK_IP', 'HEC_TOKEN', 'geotracker')
-
Run
python parse_gpx.py TRIP_GPX_FILE
where TRIP_GPX_FILE is the GPX file you exported from the mobile app. (To take this one step further and automatically run this command through Termux upon exporting your GPX file, setup an action on Llamalab's Automate.) -
And that's it! Head into the Trip Tracker app in Splunk to take a look at the OOTB dashboards, which should now be populated with data.
Using Termux and Llamalab's Automate, the process of parsing your exported GPX file and sending it to Splunk can be automated.
-
In the home folder of your phone's storage (where the DCIM, Documents, Downloads, etc. folders are located), create a new folder
MyMaps
if it doesn't already exist. Inside that, create a new foldergpx
. Download parse_gpx.py and move it inside thegpx
folder. -
Download Termux and Llamalab's Automate. Termux, if possible, should be downloaded from F-Droid rather than the Play Store, for the most up-to-date version.
-
Install Python on Termux by following the steps here. Then run
pip install requests
. -
Download this Termux plugin for the Automate app and follow the steps listed there. Then run
termux-setup-storage
nano ~/.termux/tasker/splunk.sh
and add the following to the file
cd storage/shared/MyMaps/gpx
python parse_gpx.py $(basename ${1})
and then finally run
chmod u+x ~/.termux/splunk.sh
-
Open up Automate, and create a new flow. Swipe from the right to view the list of blocks, and under
File & storage
selectFile monitor
. Select the new block and set the "Path" toMyMaps/gpx
, "Events" toFile created
, and the output variable "Path of alteration" tonew_file
. ClickSave
. -
Swipe from the right again and under
Apps
, selectPlug-in action
. Tap the new block to configure, and set the "Plug-in" toTermux
. Under the "Plug-in" field, tapConfigure
. -
For "Executable file", enter
splunk.sh
. "Arguments" should be set to%new_file
. Leave the rest as-is, and ensureExecute in a terminal session
andWait for result for commands
are checked. Click the save button at the top right. Then on the "Plug-in action" setup screen, clickSave
again. -
Finally, "wire" the flow blocks together as shown in the image below. Press the back button and click
Start
.
- The GPX export directory will now be monitored for any new files, which will automatically get parsed and sent to Splunk. To test this, simply record a trip and click the download/export button, and then watch the automation go!