Splunk Search

Search and filter by fieldname

OldManEd
Builder

I have a simple search query that is collecting data from XML. The search query is below;

sourcetype=someSourceType userid success* | rex \"FIELDA>(?<myfield>\[^\\<\]+)\"

And it gives me a bunch of data. And that's OK except my result set should not include anything where "myfield='123abc'".

Can someone tell me how to accomplish this task.
(I'm really new to Splunk.)

The input data looks like this;

<log>
    <FIELDA>111aaa</FIELDA>
</log>
<log>
    <FIELDA>123abc</FIELDA>
</log>
<log>
    <FIELDA>222bbb</FIELDA>
</log>
Tags (2)
0 Karma

OldManEd
Builder

Ayn,

Thanks but I tried that and it didn't work for some reason. But that's OK. I just came up with another solution. I added this to the query;

sourcetype=someSourceType userid success* NOT ("<FIELDA>123abc")  | rex \"FIELDA>(?<myfield>\[^\\<\]+)\"

And that seemed to work just fine.

Thanks for your suggestion.

0 Karma

jtrucks
Splunk Employee
Splunk Employee

I think there was some miscommunication. I suspect Ayn is suggesting doing:

sourcetype=someSourceType userid success* | rex \"FIELDA>(?[^\<]+)\" | search NOT myfield=123abc

Which will work.

--
Jesse Trucks
Minister of Magic

Ayn
Legend

If you're new to Splunk I'd advise you to look into why the other solution didn't work - not that the alternative solution isn't fine, just that the solution I provided should work just fine if you're extracting the field correctly.

0 Karma

Ayn
Legend

Add at the end:

... | search NOT myfield=...
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...