Splunk Enterprise

How to create a search to get the values in table format?

Vani_26
Path Finder

My sample logs is:
2022-09-12 34:45:12.456 info  Request uri [/asdff/aii/products] Request patameters [] Request payload [Request body size : : 5678 bytes Request body : : [{\activaterequest\:\ESRTYBBS\*\*, \"addresslines\":[{\"addressLineOrder\":\"NAME\"linevalues\":[\"esmal interger\"]}], \"productsio\":\"IM630\", \"productjourneykey\":\"IM630-p-6789778\",\"lineValues\":[\"sejo guleim ramo versa"]}], \"statusdesc\":\"unknown protocol version. http header [x-aacs-rest-version]. Assuming current version [v1.0]\"}],[{ \number\"4\",\"storePONumber\":\"3456\*}, \"app\",\"message\":\"Action taken when more than 10 points\"}], :[{\"serverstatuscode\":\"400 bad_request\",\"severity\", \"statusdesc\":\"Action taken when more than 10 points\"}], \"number\"6\"]

My query: index=axcf   "Action taken when more than 10 points"

but i want the following values(productsio, addressLineOrder,  linevalues, storePONumber, message, serverstatuscode, statusdesc  ) in table format.

how can i do this??


Labels (1)
Tags (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex "\\\\\"productsio\\\\\":\\\\\"(?<productsio>[^\\\\]+)"
| rex "\\\\\"addressLineOrder\\\\\":\\\\\"(?<addressLineOrder>[^\\\\]+)"
| rex "\\\\\"linevalues\\\\\":\[\\\\\"(?<linevalues>[^\\\\]+)"
| rex "\\\\\"storePONumber\\\\\":\\\\\"(?<storePONumber>[^\\\\]+)"
| rex "\\\\\"message\\\\\":\\\\\"(?<message>[^\\\\]+)"
| rex "\\\\\"serverstatuscode\\\\\":\\\\\"(?<serverstatuscode>[^\\\\]+)"
| rex max_match=0 "\\\\\"statusdesc\\\\\":\\\\\"(?<statusdesc>[^\\\\]+)"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Please confirm that the sample log is a true representation of your data, because it is a very confusing format with inconsistencies and misspellings.

Assuming it is accurate, please provide the corresponding output you are expecting to see, so we can identify how you log message might be broken down into the field values you are looking for.

Also, another couple of examples might help, so that fixed field names and variable values can more easily be identified.

0 Karma

Vani_26
Path Finder

i want the results in the below format:

productsio                      IM630

addressLineOrder      NAME

 linevalues                     ejo guleim ramo versa

storePONumber        3456

message                       Action taken when more than 10 points

serverstatuscode      400 bad_request

statusdesc                   Action taken when more than 10 points

 statusdesc                    unknown protocol version. http header [x-aacs-rest-version]. Assuming current version                                            [v1.0]

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "\\\\\"productsio\\\\\":\\\\\"(?<productsio>[^\\\\]+)"
| rex "\\\\\"addressLineOrder\\\\\":\\\\\"(?<addressLineOrder>[^\\\\]+)"
| rex "\\\\\"linevalues\\\\\":\[\\\\\"(?<linevalues>[^\\\\]+)"
| rex "\\\\\"storePONumber\\\\\":\\\\\"(?<storePONumber>[^\\\\]+)"
| rex "\\\\\"message\\\\\":\\\\\"(?<message>[^\\\\]+)"
| rex "\\\\\"serverstatuscode\\\\\":\\\\\"(?<serverstatuscode>[^\\\\]+)"
| rex max_match=0 "\\\\\"statusdesc\\\\\":\\\\\"(?<statusdesc>[^\\\\]+)"

Vani_26
Path Finder

when i am using the below rex getting below error
Regex:missing terminating ] for character class

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What exactly are you using as it looks like a copy/paste/typo?

0 Karma

Vani_26
Path Finder

yes i was entering it incorrectly.

thank you,  it helped me a lot , its working as expected.

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...