Hi all, before you proceed to read this article, please enjoy the background story of this prototype at “Mobile Analytics with Storm“. Thus the logging library for Android is now added with an option to route the crash logs into Splunk Enterprise. Yes, crash logs from Android mobile devices into Splunk Enterprise.
The installation steps are very similar to the ones described in this article “Mobile Analytics with Storm” but with some minor adjustments. Here are the steps:
[1] Download and install a Splunk Enterprise edition
[2] Obtain the splunkd URL, admin username and password. As an example SPLUNKD_URL would be “https://nkey-mbp17.sv.splunk.com:12089″, SPLUNKD_USERNAME would be “admin”, and SPLUNKD_PASSWORD would be “password”
[3] Then download the logging library either from SplunkBase (http://splunk-base.splunk.com/apps/78613/mobile-analytics-with-splunk-storm-android) or from github (https://github.com/nicholaskeytholeong/splunk-storm-mobile-analytics/blob/master/android/splunkstormmobileanalytics.jar)
[4] Include splunkstormmobileanalytics.jar into your project. This is how you can simply do it: move the jar file into libs directory of your app project
[5] Allow the Internet permission between the <manifest> tags in the AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
[6] Add the import statement into the main activity of your app
import com.splunk.android.Splunk;
[7] Connect to Splunk Storm in the onCreate() method of the main activity
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Splunk.connect("SPLUNKD_URL", "SPLUNKD_USERNAME", "SPLUNKD_PASSWORD", getApplicationContext()); /** * your other wonderful codes to develop your wonderful mobile app **/ }
[8] Congratulations! You will now be able to route crash logs from Android mobile devices into Splunk Enterprise. The end result looks as such:
Limitation: Currently this logging library assumes a public facing splunkd URL of either a Splunk forwarder or indexer. Personally I don’t think it’s a good idea to put splunkd admin username and password in the open. I’ll have to think of a more secured implementation to connect to splunkd.
Disclaimer: This is still a work in progress. Please use this logging library at your own risk. Opinions expressed in this article do not represent the views of Splunk.