All Apps and Add-ons

Splunk DB Connect 1: How to find Open Tickets with no closed date in one dbquery search?

hartfoml
Motivator

I have a database that has a trend table. In the trend table there are two entries for each ticket: One for open date and one for closed date.

I want to find the open tickets that do not have an entry for closed. If I use a join or append, then I am essentially doing the search twice: one to find open tickets and one to find closed tickets, then compare and show only tickets that do not have closed date.

I have almost 2 million tickets on the table. How would I find open events that do not have a corresponding closed event with only one search?

Would it make more sense to do this during the SQL query?

| dbquery "TicketDB" "SELECT "TicketID" FROM Trend WHERE ChangeType NOT like "closed" AND ChangeType like "open" " 

this didn't work

0 Karma

somesoni2
Revered Legend

Doing it in SQL query (as part dbquery) will require selfjoin. Since, I'm not an expert of that so, I'm not even going there.

Here is how same thing can be achieved in Splunk (please adjust the SQL on dbquery per yours)

| dbquery "TicketDB "SELECT TicketID, ChangeType FROM Trend" | stats dc(ChangeType) as StatusCount values(ChangeType) as ChangeType by TicketID | where StatusCount=1 AND ChangeType="open"
0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...