I'm a Splunk newb and am wrestling with building a specific query. Any help would be appreciated.
This is the base search.
index=index (Food="*meat*") AND (Food="*veggie*" OR Food="*fruit*")
From here, I rex the result and sort.
| rex field=_raw "location \((?<Farm>\w+)\).*operator \((?<Farmer>\w+)\).*crops \((?<CropType>\w+)\).*"
| stats list(Farm), list(CropType), count by Farmer
| sort -count
This is a good start, but it returns way more than needed, and I'm getting way out in the weeds with this. Here's the details:
- CropType contains two possible values, veggie or fruit.
- I only want to see records where one veggie and one fruit share the same Farm. (No fruit/fruit, veggie/veggie.)
The end goal here is to present a list of farms and crops per farmer.
Thanks in advance for any assistance/insight.