Getting Data In

Parse words in a search result

gnoellbn
Explorer

Hello,

I'm trying to extract data depending of one word (fail* or success*) from a field that is not always the same :

Oct 16 15:12:47 10.1.0.12 date=2013-10-16 time=15:12:47 devname=WIN_XP device_id=324156465 log_id=0000010001 type=event subtype=system pri=alert user=toto adom= msg="user 'toto' login failed from GUI(192.185.63.33)"

The info I am looking for is always in "msg=" but not always at the same place.

I have tried different way with the command below :

| stats count(eval(msg="fail")) as Failed

Thanks,

Tags (1)
0 Karma

gnoellbn
Explorer

Hey,

Thanks for your answer, we were'nt able to extract the info as we wanted. The | stats part worked fine, it listed all the fields however the | where didn't. As a workaround we found the following :

| rex "msg=\".*(?<Etat>(failed|success)).*\"" | stats count by Etat

This works great for us as we get both fields as result (failed and success)

Thanks again,
Gaetan

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee
| rex "msg=\"(<YOURFIELD>.+?)\"" | stats count(YOURFIELD) as Failed | where YOURFIELD="*FAIL*"
0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...