Hi jordanking1992,
I posted that in the slack channel #splunky2k channel:
index=* TERM(19)
| regex _raw="[\\\/\|-](19)"
| rex "(?<myField>[^\s]+19)"
| search myField!="*2019*"
| stats count by index sourcetype
It later got this little enhancement:
index=* TERM(19)
| eval sample=substr(_raw,0,128), search="index=".index." sourcetype=".sourcetype." TERM(19)"
| regex sample="(((?:^|\D)\d{1,2}[-\/]\d{1,2}[-\/]19[^\d])|((?:^|\D)19[-\/]\d{1,2}[-\/]\d{1,2}[^\d])|((?:^|\D)\d{1,2}\s[-\/]\s\d{1,2}\s[-\/]\s19[^\d])|((?:^|\D)19\s[-\/]\s\d{1,2}\s[-\/]\s\d{1,2}[^\d])|((?:^|\D)([a-zA-Z]{3}[- \/]+\d{1,2}[- \/]+19[^:\d]))|((?:^|\D)19[- \/][a-zA-Z]{3}[- \/]\d{1,2}[^:\d])|((?:^|\D)\d{1,2}[- \/]+[a-zA-Z]{3}[- \/]+19[^:\d]))"
| stats count last(sample) as sample by search
Please be aware that this is a very hungry, resource intensive search!
Hope this helps ...
cheers, MuS
UPDATE modifications to the regex and the substr() uses the first 128 characters of the event.
... View more