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!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...