Getting Data In

Extract a Value from a Field

corydm
New Member

Terminology might be off, but I'll give the exact example:
"The session setup from computer 'NOCSERVER_A123' failed because the security....." and so on. This is a field called "Message" and I would like to assign "NOCSERVER_A123" to it's own field called Hostname. My intention is that when I search, my query returns just the Hostname, and not the entire "Message" field.

I've tried a few different things to no luck, and I believe the problem is I have a very basic grasp on how to achieve this. I would really appreciate if someone could clear up how to do this, and if possible, explain it a little or give me links to some documentation/tutorial pages. I feel like what I've been doing with the transform.conf and props.conf are incorrect.

Thanks!

0 Karma

LukeMurphey
Champion

You do this easily with props and transforms. Your props.conf will look something like this:

[host_from_message]
SOURCE_KEY = Message
REGEX = The session setup from computer '(.+)' failed because the security
FORMAT = hostname::"$1"

With a transforms.conf entry like:

[your_sourcetype]
REPORT-host_from_message = host_from_message

As @Ayn said, check the docs out. They are very helpful.

Ayn
Legend
0 Karma

aholzer
Motivator

Have you tried defining a field extraction with regex?

Something like this might help you:
'(?[^']+)'

This would extract everything between two single quotes, that isn't a single quote into a field called "FIELD_NAME". You may have to escape the single quotes, I'm not 100% sure on that bit.

If your hostname isn't always contained within single quotes then you would have to play around with regex to identify the exact expression in which to extract your hostnames.

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!

How to find the worst searches in your Splunk environment and how to fix them

Everyone knows Splunk is a powerful platform for running searches and doing data analytics. Your ...

Share Your Feedback: On Admin Config Service (ACS)!

Help Us Build a Better Admin Config Service Experience (ACS)   We Want Your Feedback on Admin Config Service ...

Build the Future of Agentic AI: Join the Splunk Agentic Ops Hackathon

AI is changing how teams investigate incidents, detect threats, automate workflows, and build intelligent ...