Splunk Search

How to adjust search to remove and add user to lookup table via dashboard?

Italy1358
Path Finder

I have created a dashboard that allows you to enter a user and their information then write all of it to a lookup table. I need to help adjusting the search queries so that when you select add it writes the user to the lookup table and when you select remove it removes any instance where the users name is found in the lookup table. Here is my xml so far:

 

<panel depends="$add$">
<title>Add User</title>
<table>
<search>
<query>| inputlookup usb.csv | append [ | makeresults | eval user="$user_tok$", email="$email_tok$", description="$description_tok$", revisit="$revisit_tok$", Action="$dropdown_tok$" | fields - _time ] | table user, email, description, revisit | outputlookup usb.csv</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</table>
</panel>
<panel depends="$remove$">
<title>Remove User</title>
<table>
<search>
<query>| inputlookup usb.csv
| where user != ""
| table user, email, description, revisit
| outputlookup usb.csv
</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</table>
</panel>

 

Labels (2)
Tags (2)
0 Karma
1 Solution

etoombs
Path Finder

It looks like you're pretty close on this.  In your remove user query, you're not calling the token you have for user.  Try adding your token to the user!="" segment.

<query>| inputlookup usb.csv
| where user != "$user_tok$"
| table user, email, description, revisit
| outputlookup usb.csv
</query>

 

View solution in original post

etoombs
Path Finder

It looks like you're pretty close on this.  In your remove user query, you're not calling the token you have for user.  Try adding your token to the user!="" segment.

<query>| inputlookup usb.csv
| where user != "$user_tok$"
| table user, email, description, revisit
| outputlookup usb.csv
</query>

 

Italy1358
Path Finder

Thank You!!! that did work.

0 Karma
Get Updates on the Splunk Community!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...