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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...