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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...