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!

Stay Connected: Your Guide to January Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...

[Puzzles] Solve, Learn, Repeat: Reprocessing XML into Fixed-Length Events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Data Management Digest – December 2025

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