Splunk Search

splunks

vinod0313
Explorer

Hello

I have a log  as shown below


FeatureDetails [tokenValidatorInfo=false, requestValidationRequired=false, requestPayloadValidationRequired=false, responsePayloadValidationRequired=false, aopUsed=false, tibcoCommunicatorUsed=false, secretsSecured=false]


i want to show my result like below

tokenValidatorInfo=false
requestValidationRequired=false
requestPayloadValidationRequired=false
responsePayloadValidationRequired=false
aopUsed=false
tibcoCommunicatorUsed=false
secretsSecured=false

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @vinod0313,

if it's acceptable for you to have a table with the field name in a column and the value in another column, you could run something like this:

| makeresults
| eval _raw="FeatureDetails [tokenValidatorInfo=false, requestValidationRequired=false, requestPayloadValidationRequired=false, responsePayloadValidationRequired=false, aopUsed=false, tibcoCommunicatorUsed=false, secretsSecured=false]"
| rex "tokenValidatorInfo\=(?<tokenValidatorInfo>[^,]*), requestValidationRequired\=(?<requestValidationRequired>[^,]*), requestPayloadValidationRequired\=(?<requestPayloadValidationRequired>[^,]*), responsePayloadValidationRequired\=(?<responsePayloadValidationRequire>[^,]*), aopUsed\=(?<aopUsed>[^,]*), tibcoCommunicatorUsed\=(?<tibcoCommunicatorUsed>[^,]*), secretsSecured\=(?<secretsSecured>[^\]]*)"
| fields - _raw - _time
| transpose
| eval ppp=column."=".row1

If otherwise you want field=value, you could run something like this:

| makeresults
| eval _raw="FeatureDetails [tokenValidatorInfo=false, requestValidationRequired=false, requestPayloadValidationRequired=false, responsePayloadValidationRequired=false, aopUsed=false, tibcoCommunicatorUsed=false, secretsSecured=false]"
| rex max_match=0 "\[(?<my_field1>[^,]*), (?<my_field2>[^,]*), (?<my_field3>[^,]*), (?<my_field4>[^,]*), (?<my_field5>[^,]*), (?<my_field6>[^,]*), (?<my_field7>[^\]]*)"
| fields - _raw - _time
| transpose
| fields - column
| rename row1 AS results

Ciao.

Giuseppe

0 Karma

vinod0313
Explorer

tried but it didnt worked.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi  @vinod0313,

what result do you have if you run:

Your_search
| rex "tokenValidatorInfo\=(?<tokenValidatorInfo>[^,]*), requestValidationRequired\=(?<requestValidationRequired>[^,]*), requestPayloadValidationRequired\=(?<requestPayloadValidationRequired>[^,]*), responsePayloadValidationRequired\=(?<responsePayloadValidationRequire>[^,]*), aopUsed\=(?<aopUsed>[^,]*), tibcoCommunicatorUsed\=(?<tibcoCommunicatorUsed>[^,]*), secretsSecured\=(?<secretsSecured>[^\]]*)"

?

are the fields extracted or not?

if yes, using the other commands you can have the format you want.

If not, this means that the logs are different so the rex command fails.

In this case, could you share some other example of your logs?

Ciao.

Giuseppe

0 Karma

Nisha18789
Builder

Hello @vinod0313 , you can use below query , to remove commas and show the data as multivalued

| eval _raw="FeatureDetails [tokenValidatorInfo=false, requestValidationRequired=false, requestPayloadValidationRequired=false, responsePayloadValidationRequired=false, aopUsed=false, tibcoCommunicatorUsed=false, secretsSecured=false]"
| rex field=_raw "FeatureDetails \[(?<_raw>.*)\]"
| makemv delim="," _raw

Hope this helps!

Please upvote my response if this resolves the issue.

 

0 Karma

vinod0313
Explorer

After trying with your suggested query i am getting below response

vinod0313_0-1597989426041.png



i am not getting the result as asked like below

tokenValidatorInfo=false
requestValidationRequired=false
requestPayloadValidationRequired=false
responsePayloadValidationRequired=false
aopUsed=false
tibcoCommunicatorUsed=false
secretsSecured=false






0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @vinod0313,

Please try mine:

gcusello_0-1598000381973.png

Ciao.

Giuseppe

0 Karma

Nisha18789
Builder

Hi ,  replace |makemv with below

| rex field=_raw mode=sed "s/, /\n/g"

or, 

| rex field=_raw mode=sed "s/,/\n/g"

Hi @vinod0313 , adding a reference screenshot with the test query with which it splitting the , by a new line in _raw events

index=_internal "," sourcetype=itsi_internal_log
| rex field=_raw mode=sed "s/,/\n/g"

 

 

 

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...