Splunk Search

Want To extract values from query output and create a table

RKP
Loves-to-Learn Everything

Here is the my output data. i want to create a table for path and responsetime . can you please help.

Expecting output is below:

path                                                                                     responsetime

/rkedgeapp/provider/dental/keysearch/           156

 

{"time": 1722582494370,"host1": "arn:aws:firehose:ca-central-1:2222222:deliverystream/Splunk-Kinesis-apigateway-CA","source1": "rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl6e/prod","event": "{ \"requestId\":\"d85fa529-3979-44a3-9018-21f81e12eafd\", \"ip\": \"40.82.191.190\", \"caller\":\"-\", \"user\":\"-\",\"requestTime\":\"02/Aug/2024:07:08:14 +0000\", \"httpMethod\":\"POST\",\"resourcePath\":\"/{proxy+}\", \"status\":\"200\",\"protocol\":\"HTTP/1.1\", \"responseLength\":\"573\", \"clientCertIssuerDN\":\"C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Limited,CN=Sectigo RSA Organization Validation Secure Server CA\", \"clientCertSerialNumber\":\"22210811239199552309700144370732535146\", \"clientCertNotBefore\":\"Jan 22 00:00:00 2024 GMT\", \"clientCertNotAfter\":\"Jan 21 23:59:59 2025 GMT\", \"path\":\"/rkedgeapp/provider/dental/keysearch/\", \"responsetime\":\"156\" }"}

Labels (1)
0 Karma

RKP
Loves-to-Learn Everything

Below  query is giving the 3000 events like that, how can i make this command work for that. can please give the straight command.

index="aws-apigateway" source1="rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl/prod"

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults 
| eval _raw="{\"time\": 1722582494370,\"host1\": \"arn:aws:firehose:ca-central-1:2222222:deliverystream/Splunk-Kinesis-apigateway-CA\",\"source1\": \"rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl6e/prod\",\"event\": \"{ \\\"requestId\\\":\\\"d85fa529-3979-44a3-9018-21f81e12eafd\\\", \\\"ip\\\": \\\"40.82.191.190\\\", \\\"caller\\\":\\\"-\\\", \\\"user\\\":\\\"-\\\",\\\"requestTime\\\":\\\"02/Aug/2024:07:08:14 +0000\\\", \\\"httpMethod\\\":\\\"POST\\\",\\\"resourcePath\\\":\\\"/{proxy+}\\\", \\\"status\\\":\\\"200\\\",\\\"protocol\\\":\\\"HTTP/1.1\\\", \\\"responseLength\\\":\\\"573\\\", \\\"clientCertIssuerDN\\\":\\\"C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Limited,CN=Sectigo RSA Organization Validation Secure Server CA\\\", \\\"clientCertSerialNumber\\\":\\\"22210811239199552309700144370732535146\\\", \\\"clientCertNotBefore\\\":\\\"Jan 22 00:00:00 2024 GMT\\\", \\\"clientCertNotAfter\\\":\\\"Jan 21 23:59:59 2025 GMT\\\", \\\"path\\\":\\\"/rkedgeapp/provider/dental/keysearch/\\\", \\\"responsetime\\\":\\\"156\\\" }\"}"
``` the line above recreate your sample event ```
| spath
| spath input=event
| table path responsetime
0 Karma

RKP
Loves-to-Learn Everything

Below  query is giving the 3000 events like that, how can i make this command work for that. can please give the straight command.

index="aws-apigateway" source1="rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl/prod"

Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

index="aws-apigateway" source1="rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl/prod"
| spath
| spath input=event
| table path responsetime

 You may not need the first spath command if your ingestion path already recognises JSON data format.

0 Karma

RKP
Loves-to-Learn Everything

Its giving same output which i provided 1st.

{"time": 1722597668055,"host1": "arn:aws:firehose:ca-central-1:2222:deliverystream/Splunk-Kinesis-apigateway-CA","source1": "manuuatedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl6e/prod","event": "{ \"requestId\":\"dffc1e08-83d7-4801-b10d-239efd1b7f7d\", \"ip\": \"40.82.191.190\", \"caller\":\"-\", \"user\":\"-\",\"requestTime\":\"02/Aug/2024:11:21:08 +0000\", \"httpMethod\":\"POST\",\"resourcePath\":\"/{proxy+}\", \"status\":\"200\",\"protocol\":\"HTTP/1.1\", \"responseLength\":\"573\", \"clientCertIssuerDN\":\"C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Limited,CN=Sectigo RSA Organization Validation Secure Server CA\", \"clientCertSerialNumber\":\"22210811239199552309700144370732535146\", \"clientCertNotBefore\":\"Jan 22 00:00:00 2024 GMT\", \"clientCertNotAfter\":\"Jan 21 23:59:59 2025 GMT\", \"path\":\"/rkedgeapp/provider/dental/keysearch/\", \"responsetime\":\"172\" }"}
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What is this that you have just shown? Please provide a screenshot

0 Karma

RKP
Loves-to-Learn Everything

RKP_0-1722599050923.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What do you get if you do this

index="aws-apigateway" source1="rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl/prod"
| table event
0 Karma

RKP
Loves-to-Learn Everything

RKP_0-1722600240785.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What about when you do this?

index="aws-apigateway" source1="rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl/prod"
| spath input=event
0 Karma

RKP
Loves-to-Learn Everything

RKP_0-1722601111019.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try this

index="aws-apigateway" source1="rkedgevil-restapi-Access-Logs:API-Gateway-Access-Logs_8o2y6hzl/prod"
| spath input=event
| table *
0 Karma

RKP
Loves-to-Learn Everything

Its showing most of the values but there is no path and responsetime

 

RKP_1-1722603588838.png

RKP_2-1722603652581.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Can you do the same but scroll the view to the right to show the fields beginning with "p"

0 Karma

RKP
Loves-to-Learn Everything

Getting empty tables.

RKP_0-1722597209244.pngRKP_1-1722597224751.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Remove the table command and see what you get

0 Karma
Get Updates on the Splunk Community!

.conf25 Registration is OPEN!

Ready. Set. Splunk! Your favorite Splunk user event is back and better than ever. Get ready for more technical ...

Detecting Cross-Channel Fraud with Splunk

This article is the final installment in our three-part series exploring fraud detection techniques using ...

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...