Splunk Search

How do I create searchable fields from a single raw string?

kluey
Explorer

Hi,

I have syslogs that I would like to search for by ZONE (UNTRUST) and IP (12.12.12.1). Below is a sample of how the data is formatted as one long field. I would like to be able to do a search on ‘UNTRUST’ and then sort/count by IP (10.10.10.10) and Port (80).

Syslog sample: UNTRUST/12.12.12.1(80)

Any help would be greatly appreciated.

TIA

Tags (2)
0 Karma
1 Solution

kluey
Explorer

Hi, thanks for the response. It worked perfectly!

View solution in original post

0 Karma

kluey
Explorer

Thanks for the feedback. I have clicked the check mark to accept the answer.

0 Karma

kluey
Explorer

Hi, thanks for the response. It worked perfectly!

0 Karma

lguinn2
Legend

You are welcome!

BTW, if you accept the answer by clicking the check mark, then your question shows up as answered and other folks won't keep checking in to see if you need help.

Thanks!

0 Karma

lguinn2
Legend

You probably want to create and save field extractions. There are several ways to do this: Overview of search-time field extractions is a good place to start.

However, if you don't want to do this, you can create and use temporary fields with the rex command like this:

sourcetype=syslog untrust*
| rex "UNTRUST/(?<IP>.*?)\((?<Port>\d+)\)"
| stats count by IP Port
0 Karma
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!

(re)Introducing the Splunk Community Champions + 2026 – 2027 Splunk MVPs ...

This program exists as a channel to empower and recognize Splunk advocates and help supercharge initiatives to ...

Introducing the 2026 - 2027 SplunkTrust cohort!

The goal of the SplunkTrust™ membership has historically been to acknowledge and recognize those who go above ...

Pro Tips for .conf26: How to Prep Like a Splunk Veteran

There’s no shortage of incredible content lined up for .conf26 in Denver, from deep-dive technical sessions ...