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!

Unlock New Opportunities with Splunk Education: Explore Our Latest Courses!

At Splunk Education, we’re dedicated to providing top-tier learning experiences that cater to every skill ...

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...