Dashboards & Visualizations

How can I fix my query for a malware dashboard, which is throwing me this error: "Error in 'TsidxStats': WHERE clause is not an exact query"?

kokanne
Communicator

I'm trying to fix my query for my malware dashboard, but it doesn't seem to work in any way possible, maybe I'm just not experienced enough to fix it. The query is the following:

| `tstats` count from datamodel=Malware.Malware_Attacks where * $action$ $bunit$ $category$ by _time,Malware_Attacks.action span=10m | timechart minspan=10m useother=true count by Malware_Attacks.action | `drop_dm_object_name("Malware_Attacks")`

The error:
Error in 'TsidxStats': WHERE clause is not an exact query

If anyone could tell me what I'm doing wrong, that would be great. Sorry for posting such a stupid question.

0 Karma
1 Solution

493669
Super Champion

Firstly not required to use *(wildcard) in where clause..and what token values are setting?

View solution in original post

493669
Super Champion

okay..now try this:

| tstats count from datamodel=Malware.Malware_Attacks where * $action$ Malware_Attacks.bunit=$bunit_form$ Malware_Attacks.category="category_form" by _time,Malware_Attacks.action span=10m 
  | timechart minspan=10m useother=true count by Malware_Attacks.action 
  | `drop_dm_object_name("Malware_Attacks")`

kokanne
Communicator

Error in 'TsidxStats': WHERE clause is not an exact query

0 Karma

493669
Super Champion

now try one by one token in query :
first try only $action$ if it works then try only Malware_Attacks.bunit=$bunit_form$ and check

kokanne
Communicator

$action$ does not work

Malware_Attacks.bunit=$bunit_form$ works

Malware_Attacks.category="category_form" works

but both dont return any events

0 Karma

kokanne
Communicator
 | tstats count from datamodel=Malware.Malware_Attacks where * Malware_Attacks.action=$action$ Malware_Attacks.bunit=$bunit_form$ Malware_Attacks.category=$category_form$ by _time,Malware_Attacks.action span=10m 
   | timechart minspan=10m useother=true count by Malware_Attacks.action 
   | `drop_dm_object_name("Malware_Attacks")`

This works but no return any events

0 Karma

493669
Super Champion

are you selecting dropdown values for each dropdown and then clicking on submit and then checking query result right?

0 Karma

kokanne
Communicator

theres no dropdown, not sure what you mean

0 Karma

493669
Super Champion

from your xml I can see two dropdown , one text input and one time input and submit button isn't it?

0 Karma

493669
Super Champion

so are you running this query directly in search?
or putting it in dashboard and then checking?

0 Karma

kokanne
Communicator

search app

0 Karma

493669
Super Champion

Ohhk...then how these token will get values ...it will never get...so to work above query put it in your dashboard and check

| tstats count from datamodel=Malware.Malware_Attacks where * $action$ Malware_Attacks.bunit="$bunit_form$" Malware_Attacks.category="$category_form$" by _time,Malware_Attacks.action span=10m 
   | timechart minspan=10m useother=true count by Malware_Attacks.action 
   | `drop_dm_object_name("Malware_Attacks")`

kokanne
Communicator

doesnt seem to work for dashboard either, but my workday is done now, i will look again monday

thanks for help-

0 Karma

493669
Super Champion

just paste your query what you have tried in dashboard...bye

kokanne
Communicator

I tried:

| tstats count from datamodel=Malware.Malware_Attacks where * Malware_Attacks.bunit=$bunit$ Malware_Attacks.category=$category$ by _time,Malware_Attacks.action span=10m 
| timechart minspan=10m useother=true count by Malware_Attacks.action 
| `drop_dm_object_name("Malware_Attacks")`

But gives error in dashboard:

Comparator '=' is missing a term on the right hand side.

I don't know where?

0 Karma

493669
Super Champion

as per your xml your token is $category_form$ instead of $category$

also $bunit_form$ instead of $bunit$

kokanne
Communicator
| tstats count from datamodel=Malware.Malware_Attacks where * Malware_Attacks.bunit=$bunit_form$ Malware_Attacks.category=$category_form$ by _time,Malware_Attacks.action span=10m 
| timechart minspan=10m useother=true count by Malware_Attacks.action 
| `drop_dm_object_name("Malware_Attacks")`

Still produces same error

0 Karma

493669
Super Champion

ok first try below in search app:

| tstats count from datamodel=Malware.Malware_Attacks where * by _time,Malware_Attacks.action span=10m 
     | timechart minspan=10m useother=true count by Malware_Attacks.action 
     | `drop_dm_object_name("Malware_Attacks")`

Does it working?

kokanne
Communicator

Yes this works, but not with tokens

0 Karma

493669
Super Champion

yes it will only work without tokens in search app
now go to your dashboard and edit and add below query with only one token:

 | tstats count from datamodel=Malware.Malware_Attacks where * $action$  by _time,Malware_Attacks.action span=10m 
    | timechart minspan=10m useother=true count by Malware_Attacks.action 
    | `drop_dm_object_name("Malware_Attacks")`

kokanne
Communicator

yes is working

0 Karma

493669
Super Champion

ok now add second token in it:

| tstats count from datamodel=Malware.Malware_Attacks where * $action$ Malware_Attacks.bunit=$bunit_form$  by _time,Malware_Attacks.action span=10m 
     | timechart minspan=10m useother=true count by Malware_Attacks.action 
     | `drop_dm_object_name("Malware_Attacks")`
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...