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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...