Splunk Search

How to convert SQL query to Splunk search?

idkgirly
Loves-to-Learn

Hi,

I have the following tables:

asset table:
asset_id
solution_id
vulnerability_id

solution table:
solution_id
solution summary

vulnerability table:
vulnerability_id
title
severity

How do I write a splunk query to show a table that has the asset_id, solution summary, title, and severity?

This would be the SQL query that I use:

 

 

 

SELECT a.asset_id, b.solution_id, b.summary as solution_summary, c.vulnerability_id, c.title as vulnerability_title, c.severity
FROM asset a
JOIN solution b USING (solution_id) 
JOIN vulnerability c USING(vulnerability_id)

 

 

 

 

 

Tags (1)
0 Karma

woodcock
Esteemed Legend

Where is this data?  In SQL DB?  In Splunk events?  In a Splunk lookup file?

0 Karma

somesoni2
Revered Legend

Give this a try

(index=asset_index sourcetype=asset_sourcetype)
| fields asset_id, solution_id, vulnerability_id
| join type=left solution_id [search index=solution_index sourcetype=solution_sourcetype | fields solution_id, solution_summary]
| join type=left vulnerability_id [search index=vulnerability_index sourcetype=vulnerability_sourcetype | fields vulnerability_id, title, severity | rename title as vulnerability_title]
| table asset_id solution_summary vulnerability_title severity
0 Karma

idkgirly
Loves-to-Learn

I ran the query, but it does not return all the data.  I was able to get a complete list of the asset_id, solution_id, and vulnerability_id, however, there are a few that are empty under solution_summary, vulnerability_title, and severity. Am I missing something in the query?

asset_idsolution_idvulnerability_idvulnerability_titlesolution_summaryseverity
1234456234Certificate expiredObtain new certifcateSevere
1234678567Security Update for Windows Critical
1234890893   

 

0 Karma
Get Updates on the Splunk Community!

Best Strategies to Optimize Observability Costs

 Join us on Tuesday, May 6, 2025, at 11 AM PDT / 2 PM EDT for an insightful session on optimizing ...

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...