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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...