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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...