I have a CSV containing wine names, vintages and prices, e.g.
Description,Vintage,Price
A,2012,100
A,2013,
B,2014,
B,2015,30
C,2010,50
I want to lookup a chosen wine and vintage and return the price for a wine/vintage match, which is easy
| lookup Price Description, Vintage OUTPUT Price
However, I want to be able to show a 'guide' price where the vintage wanted has no price, so I've played around with searching all results, and then trying to filter out any exact matches.
If I am searching for Wine A, 2013 then I would get a hit, with no price, so I would want to see (2012)100
If I am searching for Wine C, 2012, then I would not get a match at all, so I would want to see (2010)50
Getting all matches is also easy
| lookup DMPrice Description OUTPUT Price as Prices, Vintage as Vintages
But then I can't filter out an exact matches I may have found. I have tried using eval statements to replace the output mv field Vintages in the above lookup, but you can't use fields as parameters to replace. Same with rex, so I am a bit stumped.
As with all things Splunk, there are 101 ways to achieve the same end, so hoping someone else can see a solution
... View more