Splunk Search

How to write regex to capture Windows 7 only?

biswa2112
Engager

Hi all,

I need to get the value Windows 7 from the below string . used something like OS[\n]+([^\n]+) , but then it captures from Value till Windows 7.  Could someone please help me in capturing only windows 7?

DeviceProperties: [ [-]
{ [-]
Name: OS
Value: Windows 7 

 

 

Labels (3)
0 Karma
1 Solution

martinpu
Communicator
|rex "OS\s*Value:\s*(?<OS>[^\n]+)"

Should work, it extracts the value after keywords OS\s*Value: until new line

 

View solution in original post

martinpu
Communicator
|rex "OS\s*Value:\s*(?<OS>[^\n]+)"

Should work, it extracts the value after keywords OS\s*Value: until new line

 

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Rounding off the Splunk Dashboard Contest

What does a contest-winning Splunk dashboard look like? In this case, it isn't in a browser tab at all. It ...