Splunk Search

How to get latest parameter from csv disregarding empty values

mishaaaaaaaaaa
Explorer

Hi splunk comunity!

I have dashboard with text input, which starts to execute when i change my parameter in text box, in query i write this parameter to my csv file.
In another dashboard i'm trying to read latest value of this parameter, but if i post an empty field in my first dashboard i get an empty result in my second.
So the question is how to check an empty value like method isEmpty() in java or how to ban empty fields passing to csv file in first dashboard?
Or how can i display last not empty value?

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@mishaaaaaaaaaa ,

Either use | where isnotnull(field) while reading or check with isnotnull(field) or isnull(field) before writing,

Reference : https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/InformationalFunctions

---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

@mishaaaaaaaaaa ,

Either use | where isnotnull(field) while reading or check with isnotnull(field) or isnull(field) before writing,

Reference : https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/InformationalFunctions

---
What goes around comes around. If it helps, hit it with Karma 🙂

mishaaaaaaaaaa
Explorer

@renjith.nair This doesn't work, i've already tryed something like this, but i still get an emty field in my second dushboard

| makeresults
| eval param="$firstParam$"
| eval parameter=if(isnull(param), 50, param)
| outputcsv append=true mishasTestParametrization.csv
| table parameter

| inputcsv mishasTestParametrization.csv
| stats latest(parameter) as latestParam

0 Karma

renjith_nair
Legend

in that case, it might not be null() but just an empty space , try adding this

if(isnull(param) OR param=="", 50, param)

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

mishaaaaaaaaaa
Explorer

@renjith.nair yes this works, but i understud that this is not what i want. I need to write to csv if my param is not empty and don't write if it's empty

0 Karma

renjith_nair
Legend

@mishaaaaaaaaaa ,
Same can be used in the outputlookup as well. Taking your example

| makeresults
| eval param="$firstParam$"
| where param!="" AND isnotnull(param)
| outputcsv append=true mishasTestParametrization.csv
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

mishaaaaaaaaaa
Explorer

thanks a lot, that works perfect!

0 Karma
Get Updates on the Splunk Community!

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 ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...