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

 

Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...