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!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...