Getting Data In

How to extract fields from database column using sql query on splunk db connect application.

firefox95
Explorer

Hi All,

I kindly request your help to get fields extracted from database column. I'm working on splunk db-connect app. Can anyone please provide me sample sql query to extract subfields from status field?

For e.g. I would need something like msg=login failed, host and ip fields to be extracted from below unique database records. 

Sample Database output with unique records from splunk db-connect app:

 Date   User  Input        Status

  xxx     abc      123        login failed...

                                            host=xyz |

                                            ip=0.0.0.0 |

 yyy      xyz      456       login successful

 zzz     pqr       789       host=xyz |

                                           ip=0.0.0.0 |

 

Appreciate your help!!

                                        

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

You should contact a DBA for the database in question for help writing a SQL query for that database.

---
If this reply helps you, Karma would be appreciated.
0 Karma

saravanan90
Contributor

extract command in Splunk may help..

Sample query:

|makeresults | eval _raw=" Status
login failed...\nhost=xyz |\nip=0.0.0.0
login successful
host=xyz |\n ip=0.0.0.0 |" | multikv forceheader=1 | eval Status=split(Status,"\n") | eval temp=_raw,_raw=Status | extract | rename temp as _raw

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...