Splunk Search

subsearch using dbquery did not show the results ?

chaitat
New Member

I'm having problems using a dbquery command to filter the results of a search.
When I run this search :
| dbquery trams_nw "SELECT daily_report_date,symbol,ytm,updated_date
FROM v_splunk_trade_transaction_updated_date_view where convert(varchar(10),daily_report_date,120) ='2015-06-30'"
[ dbquery trams_nw "SELECT daily_report_date,symbol,ytm,updated_date
FROM v_splunk_trade_transaction_updated_date_view where convert(varchar(10),daily_report_date,120) ='2015-06-30'"
| stats count by symbol
| sort -count
| streamstats dc(symbol) as rank
| where rank=1
| table symbol]
| table symbol ytm

when I got result from this search as below. It's seem that the query in subsearch part not working
symbol ytm
1. CALL2OA 4.45
2. CALL2OA 4.36
3. CALL66A 2.80
4. C15O22A 1.46
5. C15O22A 1.61
6. C15O22A 1.47
7. C15O22A 1.70
8. C15O22A 1.67

the result should be like this
1. C15O22A 1.465

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Modify your search like this and try again:

| dbquery ...
| search [dbquery ...]
| ...

Basically, add a search command before the second dbquery.

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Modify your search like this and try again:

| dbquery ...
| search [dbquery ...]
| ...

Basically, add a search command before the second dbquery.

0 Karma

chaitat
New Member

Thankyou verymuch martin_mueller. It's working as I want.

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...