Splunk Search

Capturing specific string from log using regex

freephoneid
Path Finder

Hi,

I've below log lines in below format:

[2011-09-30 23:33:20:465 GMT+00:00][F3951B38F4DF45440927EDF522D5C9FF.http-8080-3][com.abc.xyz.MyWrapper] DEBUG alive?=false native?=true vision?true

How can I get the values of alive, native & vision variables? Please note that after vision?, there is no "=" sign. Log is not consistent. I also want to count how many of them are with alive &whats the count for native & vision...

Appreciate your help!

Thanks!

Tags (3)
0 Karma
1 Solution

Ayn
Legend

Is your question regarding a regex for this specific log event? If so, this one should do it:

| rex "DEBUG alive\?=(?<alive>\S+)\s+native\?=(?<native>\S+)\s+vision\?(?<vision>\S+)"

View solution in original post

0 Karma

Ayn
Legend

Is your question regarding a regex for this specific log event? If so, this one should do it:

| rex "DEBUG alive\?=(?<alive>\S+)\s+native\?=(?<native>\S+)\s+vision\?(?<vision>\S+)"
0 Karma

Ayn
Legend

field=_raw is used implicitly unless you specify anything else. Sometimes you might want to use another field for rex to operate on, but most commonly you'll extract fields from the raw event data. field=_raw can be used to show more explicitly that you're operating on the raw field, but really there is no functional reason for including it.

0 Karma

freephoneid
Path Finder

When do we use rex field=_raw ??...You didn't use it here...Just wondering...

0 Karma
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!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...