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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...