Splunk Search

Event Builder

msn2507
Path Finder

I am a newbie to splunk and looking to build events for the below log,

{
"crash_reasons": [
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "service.task.PendingTaskController",
"created_at": "2013-06-03T02:36:58Z",
"file": "PendingTaskController.java",
"fixed": false,
"id": 4412735,
"last_crash_at": "2013-06-03T06:52:44Z",
"line": "36",
"method": "cancelAllPendingTasks",
"number_of_crashes": 4,
"reason": "java.lang.RuntimeException: Unable to pause activity {au.com.customer/au.com.customer.view.activity.MainActivity}: java.util.ConcurrentModificationException",
"status": 0,
"updated_at": "2013-06-03T06:52:48Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.adapter.TrackItemAdapter",
"created_at": "2013-06-04T07:25:24Z",
"file": "TrackItemAdapter.java",
"fixed": false,
"id": 4433126,
"last_crash_at": "2013-06-04T07:25:24Z",
"line": "72",
"method": "update",
"number_of_crashes": 2,
"reason": "java.lang.RuntimeException: Unable to resume activity {au.com.customer/au.com.customer.view.activity.MainActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0",
"status": 0,
"updated_at": "2013-06-04T07:25:24Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.adapter.TrackItemAdapter",
"created_at": "2013-06-04T07:25:28Z",
"file": "TrackItemAdapter.java",
"fixed": false,
"id": 4433129,
"last_crash_at": "2013-06-04T07:25:25Z",
"line": "72",
"method": "update",
"number_of_crashes": 1,
"reason": "java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0",
"status": 0,
"updated_at": "2013-06-04T07:25:28Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.CustomerCollectionAddressView",
"created_at": "2013-06-04T08:46:37Z",
"file": "CustomerCollectionAddressView.java",
"fixed": false,
"id": 4433786,
"last_crash_at": "2013-06-04T08:46:33Z",
"line": "200",
"method": "enableFields",
"number_of_crashes": 1,
"reason": "java.lang.NoSuchMethodError: android.view.View.setAlpha",
"status": 0,
"updated_at": "2013-06-04T08:46:37Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "model.customercollection.CustomerCollectionPoint",
"created_at": "2013-06-04T23:58:14Z",
"file": "CustomerCollectionPoint.java",
"fixed": false,
"id": 4449359,
"last_crash_at": "2013-06-13T22:58:36Z",
"line": "95",
"method": "getOpenHoursByWeekDay",
"number_of_crashes": 30,
"reason": "java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-13T22:58:38Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "android.view.View$1",
"created_at": "2013-06-05T01:51:04Z",
"file": "View.java",
"fixed": false,
"id": 4451028,
"last_crash_at": "2013-06-05T01:51:04Z",
"line": "3647",
"method": "onClick",
"number_of_crashes": 1,
"reason": "java.lang.IllegalStateException: Could not find a method onRenameClick(View) in the activity class au.com.customer.view.activity.TrackItemDetailActivity for onClick handler on view class android.widget.ImageView with id 'imageRename'",
"status": 0,
"updated_at": "2013-06-05T01:51:05Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.PinFragment",
"created_at": "2013-06-05T02:30:44Z",
"file": "PinFragment.java",
"fixed": false,
"id": 4451613,
"last_crash_at": "2013-06-05T02:30:42Z",
"line": "193",
"method": "showAlert",
"number_of_crashes": 1,
"reason": "java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-05T02:30:44Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "model.shipping.consignment.DefaultConsignmentManager",
"created_at": "2013-06-05T02:55:04Z",
"file": "DefaultConsignmentManager.java",
"fixed": false,
"id": 4451916,
"last_crash_at": "2013-06-05T02:55:04Z",
"line": "256",
"method": "getLodgementMethod",
"number_of_crashes": 1,
"reason": "java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.customer/au.com.customer.view.activity.CreditCardActivity}: java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-05T02:55:04Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "model.shipping.transform.ShippingConsignmentArticleBasketTransformer",
"created_at": "2013-06-05T07:33:14Z",
"file": "ShippingConsignmentArticleBasketTransformer.java",
"fixed": false,
"id": 4455594,
"last_crash_at": "2013-06-05T07:33:11Z",
"line": "33",
"method": "createArticleTransactonsFrom",
"number_of_crashes": 2,
"reason": "java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-05T07:33:14Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.customerBaseActivity",
"created_at": "2013-06-07T03:33:51Z",
"file": "customerBaseActivity.java",
"fixed": false,
"id": 4504115,
"last_crash_at": "2013-06-07T03:33:47Z",
"line": "41",
"method": "onCreate",
"number_of_crashes": 1,
"reason": "java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.customer/au.com.customer.view.activity.PayPalPaymentActivity}: java.lang.IllegalStateException: Already attached",
"status": 0,
"updated_at": "2013-06-07T03:33:52Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.InformationLinkActivity",
"created_at": "2013-06-07T04:04:07Z",
"file": "InformationLinkActivity.java",
"fixed": false,
"id": 4504821,
"last_crash_at": "2013-06-07T04:04:06Z",
"line": "70",
"method": "onCreate",
"number_of_crashes": 2,
"reason": "java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.customer/au.com.customer.view.activity.InformationLinkActivity}: java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-07T04:04:07Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "service.security.UserContextImpl$Encryptor",
"created_at": "2013-06-10T23:58:12Z",
"file": "UserContextImpl.java",
"fixed": false,
"id": 4615064,
"last_crash_at": "2013-06-10T23:58:10Z",
"line": "271",
"method": "encrypt",
"number_of_crashes": 1,
"reason": "java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {au.com.customer/au.com.customer.view.activity.LoginActivity}: java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-10T23:58:12Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.ToAddressFragment",
"created_at": "2013-06-11T03:33:03Z",
"file": "ToAddressFragment.java",
"fixed": false,
"id": 4618296,
"last_crash_at": "2013-06-11T03:33:00Z",
"line": "304",
"method": "onClick",
"number_of_crashes": 1,
"reason": "java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-11T03:33:03Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.TrackItemFragment",
"created_at": "2013-06-12T00:54:20Z",
"file": "TrackItemFragment.java",
"fixed": false,
"id": 4643565,
"last_crash_at": "2013-06-14T06:26:13Z",
"line": "168",
"method": "showErrorToast",
"number_of_crashes": 2,
"reason": "java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-14T06:26:17Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.customerBaseActivity",
"created_at": "2013-06-12T03:41:43Z",
"file": "customerBaseActivity.java",
"fixed": false,
"id": 4646324,
"last_crash_at": "2013-06-12T03:41:43Z",
"line": "89",
"method": "onResume",
"number_of_crashes": 1,
"reason": "java.lang.RuntimeException: Unable to resume activity {au.com.customer/au.com.customer.view.activity.CountryListActivity}: java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-12T03:41:43Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.CreditCardActivity",
"created_at": "2013-06-12T04:57:26Z",
"file": "CreditCardActivity.java",
"fixed": false,
"id": 4647346,
"last_crash_at": "2013-06-26T00:29:35Z",
"line": "139",
"method": "disableTextSelection",
"number_of_crashes": 4,
"reason": "java.lang.NoClassDefFoundError: au.com.customer.view.activity.CreditCardActivity$1",
"status": 0,
"updated_at": "2013-06-26T00:29:35Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "presenter.PaymentCompletePresenter",
"created_at": "2013-06-12T07:05:18Z",
"file": "PaymentCompletePresenter.java",
"fixed": false,
"id": 4649153,
"last_crash_at": "2013-06-14T01:21:40Z",
"line": "87",
"method": "setPickupDropOffDetails",
"number_of_crashes": 7,
"reason": "java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.customer/au.com.customer.view.activity.PaymentCompleteActivity}: java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-14T01:21:41Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.MainMenuFragment",
"created_at": "2013-06-12T08:19:11Z",
"file": "MainMenuFragment.java",
"fixed": false,
"id": 4650166,
"last_crash_at": "2013-06-12T08:19:11Z",
"line": "139",
"method": "enableOrderSummaryMenu",
"number_of_crashes": 1,
"reason": "java.lang.IllegalStateException: Fragment MainMenuFragment{407835d0} not attached to Activity",
"status": 0,
"updated_at": "2013-06-12T08:19:11Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.InformationLinkActivity",
"created_at": "2013-06-13T23:48:38Z",
"file": "InformationLinkActivity.java",
"fixed": false,
"id": 4695964,
"last_crash_at": "2013-06-13T23:48:29Z",
"line": "69",
"method": "doOnCreate",
"number_of_crashes": 1,
"reason": "java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.customer/au.com.customer.view.activity.InformationLinkActivity}: java.lang.NullPointerException",
"status": 0,
"updated_at": "2013-06-13T23:48:38Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "view.activity.FindStoreActivity",
"created_at": "2013-06-14T05:51:45Z",
"file": "FindStoreActivity.java",
"fixed": false,
"id": 4702898,
"last_crash_at": "2013-06-14T06:39:20Z",
"line": "135",
"method": "onProgressEnd",
"number_of_crashes": 4,
"reason": "java.lang.RuntimeException: An error occured while executing doInBackground()",
"status": 0,
"updated_at": "2013-06-14T06:39:21Z"
},
{
"app_id": 24669,
"app_version_id": 94,
"bundle_short_version": "Release 1.0.0.94.sit | Build 1",
"bundle_version": "1",
"class": "model.location.MapHandler$DelayedCameraChangeRunnable$1",
"created_at": "2013-06-14T06:39:23Z",
"file": "MapHandler.java",
"fixed": false,
"id": 4703678,
"last_crash_at": "2013-06-14T06:39:22Z",
"line": "233",
"method": "onError",
"number_of_crashes": 1,
"reason": "java.lang.RuntimeException: An error occured while executing doInBackground()",
"status": 0,
"updated_at": "2013-06-14T06:39:24Z"
}
],
"current_page": 1,
"per_page": 25,
"status": "success",
"total_entries": 21,
"total_pages": 1
}

I would like to build the event based on the data that lies between { } and would like to strip the rest ex -

{ "crashreasons": [

&

],
"current_page": 1,
"per_page": 25,
"status": "success",
"total_entries": 21,
"total_pages": 1
}

any help on building this event is appreciated.

Tags (2)
0 Karma

kristian_kolb
Ultra Champion

This might work. Then again, it might not. Don't know how readily SEDCMD will handle newlines. Have not tried it. Use at your own risk.

props.conf (on indexer/heavy forwarder - NOT on universal forwarder)

[your_sourcetype]
SHOULD_LINEMERGE=false
LINE_BREAKER = (\s*\},[\r\n]\s*\{)
SEDCMD-strip_header = s/\s*\{\s*[\r\n]\s*\"crashreasons\":\s*\[[\r\n]\s*\{\s*[\r\n]//
SEDCMD-strip_footer = s/\s*\],\s*([\r\n].*)+$//
TIME_PREFIX = updated_at": "

/k

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...