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!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...