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

kokanne
Communicator

after putting the default its working

0 Karma

493669
Super Champion

Glad it works ☺

493669
Super Champion

add $action$ in <title> tag and check what is value is set?

0 Karma

kokanne
Communicator

Hi, the wildcard I should replace with % ?
The tokens are shown in query, action bunit and category

0 Karma

493669
Super Champion

No, you can not replace it with %..Do you really need wildcard here as where clause is used to to filter search results.
$action$ $bunit$ $category$ these tokens value is getting populating from different input/panel ..so In these token what values are setting .

0 Karma

kokanne
Communicator

Okay,I remove the wildcard completely

To be honest, this query was not built by me, it's part of the enterprise security dashboards, but stopped working 2 weeks ago. I would assume that its like this:

action=$action$
punct=$bunit$
category=$category$

0 Karma

493669
Super Champion

wait ..retain * and try in query datamodel=Malware_Attacksor datamodel=Malware
If you try only | tstats count from datamodel=Malware.Malware_Attacks does it returning events?

kokanne
Communicator
| `tstats` count from datamodel=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")`

Error in 'TsidxStats': Could not find datamodel: Malware_Attacks

| `tstats` count from datamodel=Malware 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")`

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

0 Karma

493669
Super Champion

try running query in parts and check when you are receiving error?

 | tstats count from datamodel=Malware.Malware_Attacks

and then try to run

| tstats count from datamodel=Malware.Malware_Attacks where * $action$ $bunit$ $category$ 

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

Runs fine, returns 31 Statistics
Results are not accurate, returns null values for when there should be events

 | 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")`

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

The problem, I think, is with the tokens, but I don't know how to fix

0 Karma

493669
Super Champion

and if try this then?

 | 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")`
0 Karma

kokanne
Communicator

Works, returns more events, as well on the day today when there should be, but very long it is on null from timeframe 2 weeks

0 Karma

493669
Super Champion

so when you are adding tokens it gives an error right?

0 Karma

kokanne
Communicator

Yes that is correct, the tokens make error

0 Karma

493669
Super Champion

so add these token in <title>$action$ $bunit$ $category$</title> your xml and check what values are being set there?

kokanne
Communicator

I put it in the xml , do not see displayed, what do ?

0 Karma

493669
Super Champion

have you put below <table> ?

0 Karma

kokanne
Communicator

sorry, my bad. this is what i see:

alt text

0 Karma

493669
Super Champion

it seems no token value is getting set

0 Karma

493669
Super Champion

is there any token=bunitlike present in your xml?
not sure if they dont have any values then why are these tokens are used..

0 Karma

kokanne
Communicator

Like said, it's from enterprise security, when i look at XML , i can tell that "bunit" is for business unit .. look

  <fieldset autoRun="true" submitButton="true">
    <input type="dropdown" token="action">
      <label>Action</label>
      <choice value="">All</choice>
      <populatingSearch fieldForValue="action" fieldForLabel="action">| `cim_malware_actions`</populatingSearch>
      <default></default>
      <prefix>Malware_Attacks.action="</prefix>
      <suffix>"</suffix>
    </input>
    <input type="text" token="bunit_form">
      <label>Business Unit</label>
      <default></default>
    </input>
    <input type="dropdown" token="category_form">
      <label>Category</label>
      <choice value="">All</choice>
      <populatingSearch fieldForValue="category" fieldForLabel="category">| `categories`</populatingSearch>
      <default></default>
    </input>
    <input type="time">
      <default>Last 24 hours</default>
    </input>
  </fieldset>
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...