Splunk Search

How can I extract these fields to have a table output with the field value (AAAAA) rather than name="AAAAA"?

isabellechristo
New Member

Hello,

I have _raw data like this:
time , name="AAAAAA",first_name="BBBBB"

When I look with table I saw this :

_time                name                    first_name
12/20/2017    name="AAAAA"   first_name="BBBBB"

How can I have the output result in showing the fields this way instead:

_time                name                    first_name
12/20/2017    "AAAAA"                 "BBBBB"

Thank you for your help

0 Karma

nickhills
Ultra Champion

To quickly fix this, so you can render your table correctly try:

<your search>|rex field=name "name=(?<newname>.*)"|rex field=first_name "first_name=(?<newfirst_name>.*)"|table _time newname newfirst_name

However as @richgalloway points out - you should probably fix this in props.conf

If my comment helps, please give it a thumbs up!
0 Karma

lukas_loder
Communicator

If you use it only once you can try it with this command

| rex field=_raw "name=\"(?<name>[^\"].+)\",first_name=\"(?<first_name>[^\"].+)\""

If you are using it more then one. Try to extract new fields with the field extractor. There you can also use the regex from above.

0 Karma

msivill_splunk
Splunk Employee
Splunk Employee

Standalone example using rex and overwriting existing field values

| makeresults 
| eval name = "name=\"AAAA\"" 
| eval first_name = "first_name=\"BBBB\"" 
| rex field=name "name=(?<name>.*)" 
| rex field=first_name "first_name=(?<first_name>.*)"

Standalone example showing further field extractions with rex (in case you wanted to remove the quotes)

| makeresults 
| eval name = "name=\"AAAA\"" 
| eval first_name = "first_name=\"BBBB\"" 
| rex field=name "name=(?<name2>.*)" 
| rex field=name "name=\"(?<name3>.*)\"" 
| rex field=first_name "first_name=(?<first_name2>.*)" 
| rex field=first_name "first_name=\"(?<first_name3>.*)\""
0 Karma

richgalloway
SplunkTrust
SplunkTrust

It's probably something simple like adding kv_mode = auto to your props.conf file. We could help more if you would share the props.conf settings for that sourcetype.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...