Splunk Search

How to extract field using regex?

evallja
Path Finder

Hello everyone,

Please, I need to extract a field named product (with its value in bold) from the below Message field values, and a field named status (with its value in italics):

Message="Product: Microsoft SQL Server 2019 LocalDB -- Installation completed successfully."
Message="Product: Microsoft OLE DB Driver for SQL Server -- Installation completed successfully."

Thank you in advance.

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @evallja,

please try this:

| rex field=Message "^Product:\s+(?<Product>[^-]+)"

that you can test at https://regex101.com/r/922J2Q/1

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @evallja,

please try this:

| rex field=Message "^Product:\s+(?<Product>[^-]+)"

that you can test at https://regex101.com/r/922J2Q/1

Ciao.

Giuseppe

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!

Your Feedback. Our Roadmap. Visit the PX Feedback Booth at .conf26

You use Splunk every day, come and help shape what's next.  Save Your Seat: Product-Focused Sessions at ...

Agentic SOC Triage: Investigating Splunk ES Notables with MCP Server and a Local LLM

The Problem: Too Many Alerts, Too Little Context Security operations teams running Splunk Enterprise Security ...

Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas

Watch Now Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas     Do you ever feel ...