I have events in JSON format as follows -
Event 1:
{ QP_A:abc@gmail.com, QP_B:123, COUNTRY:USA}
Event 2:
{ QP_C:XYZ@gmail.com, QP_B:123, COUNTRY:USA}
Event 3:
{ QP_f:100, QP_Bb:123, COUNTRY:USA}
Event 4:
{ COUNTRY:USA, STATE:CT}
Event 5:
{ QP_A[0][A]:abc@gmail.com, COUNTRY:USA, STATE:CT}
Observe that QP_* fields don't appear in all events and even if they did they may not have a field that has an email address.
I am trying to search and list all QP_* fields that have email addresses in them. How can I do it?
I tried using foreach command, but no luck in the syntax -
index=abc QP_*
| foreach QP_* [eval fieldnames = if(match(<>, ".com"), "<>", "NoMatch")] | table _raw fieldnames
I see the output (may be wrong but) I see error that says something like -
[splunkindxers-001] Failed to parse templatized search for field 'QP_A[0][A]'
The output I am looking for in case of my above events is -
QP_A
QP_C
QP_A[0][A]
Thanks!
... View more