All Apps and Add-ons

Extract Data with Field Definition

ciscotek9
New Member

How would you extract particular info from raw data that is not defined by a field and then add it to a new field?

The name of databases being sent to logs all end in *db but can appear randomly in the raw data.

We want to pull them from raw data put them in column by themselves named "Database" with the corresponding raw data line that it appears in.

95% of the databases named end in "*db". A few are one offs but when we can find the solution for the ones that end in *db hopefully the answer will come.

0 Karma

kristian_kolb
Ultra Champion

Well, one thing to try is to use rex to extract the name as a field. If this works fine, you can then make it permanent by making the changes in props.conf (or via IFX).

Consider these sample events;

"The quick brown fox-db jumps over the lazy dog"
"All work and no play makes Jack a dull boydb"
"Crane-db, the most powerful tool at the building site" 

To extract the database-strings from these type of events, you might try;

...| rex "(?<my_db>\S+db)" | table my_db

and the output would be;

my_db
-----
fox-db
boydb
Crane-db

Please provide a few sample events if you want more qualified advice.

lukejadamec
Super Champion

Can you post some examples of the logs, and point out what you mean by 'raw data line'?

0 Karma
Get Updates on the Splunk Community!

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 ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco &#43; Splunk! We’ve ...