Hi everyone
I do a search in Splunk and this is the results
Name | Price | Date |
apple | 23568 | 9/18/2020 |
apple | 23346 | 9/18/2020 |
apple | 22697 | 9/18/2020 |
apple | 20 | 9/18/2020 |
apple | 22674 | 9/19/2020 |
apple | 25987 | 9/19/2020 |
apple | 26796 | 9/19/2020 |
apple | 25341 | 9/19/2020 |
I have a lookuptable file named apple.csv which is comprised of these contents.
Name | Date | Max_Price | Min_Price |
apple | 9/18/2020 | 24250 | 22120 |
apple | 9/19/2020 | 26920 | 24250 |
So I want to add the Max_Price and Min_Price to the main search something like this
Name | Price | Date | Max_Price | Min_Price |
apple | 23568 | 9/18/2020 | 24250 | 22120 |
apple | 23346 | 9/18/2020 | 24250 | 22120 |
apple | 22697 | 9/18/2020 | 24250 | 22120 |
apple | 20 | 9/18/2020 | 24250 | 22120 |
apple | 22674 | 9/19/2020 | 26920 | 24250 |
apple | 25987 | 9/19/2020 | 26920 | 24250 |
apple | 26796 | 9/19/2020 | 26920 | 24250 |
apple | 25341 | 9/19/2020 | 26920 | 24250 |
and then I can determine the wrong result. I mean the following result is not acceptable to me and they're may be wrong or something else.
apple | 20 | 9/18/2020 |
apple | 22674 | 9/19/2020 |
Thanks in advance
Hi @mzn1979,
you have to run something like this:
your_search
| lookup apple.csv Name Date OUTPUT Max_Price Min_Price
| Table Name Price Date Max_Price Min_Price
so you can list all the items adding the two columns from the lookup.
Then, if you want to check the Price with Max and Min, you have to add an eval statement:
| eval check=if(Price>Min_price AND Price<MaxPrice, "OK","NOK")
so you can filter the results:
| where check="NOK"
to have only the ones with Price outside the Min-Max range.
Ciao.
Giuseppe
Hi @mzn1979,
you have to run something like this:
your_search
| lookup apple.csv Name Date OUTPUT Max_Price Min_Price
| Table Name Price Date Max_Price Min_Price
so you can list all the items adding the two columns from the lookup.
Then, if you want to check the Price with Max and Min, you have to add an eval statement:
| eval check=if(Price>Min_price AND Price<MaxPrice, "OK","NOK")
so you can filter the results:
| where check="NOK"
to have only the ones with Price outside the Min-Max range.
Ciao.
Giuseppe
Thank you. That worked perfectly