Splunk Search

Eval on a string and stats

nbharadwaj
Path Finder

I have a several log lines like this:

X:20100507193758.385:50:INFO:DTM:AppServerStartupTaskManager-pool-1-thread-1:Release Version Information Release Name: 164.18.1 Deployment Changelist:

How do I parse this to report on the Release Name string? I want to generate stats on how many releases I have had in a month/quarter.

Something like this does not give me what I want, I have to input some regular expressions here I think:

index="x" "Release Name: 164." | eval releaseName="Release Name: 164.*" | stats distinct_count(hosts) by releaseName, instance

Tags (1)
0 Karma
1 Solution

dwaddle
SplunkTrust
SplunkTrust

Use a regular expression (regex) to extract this as a search-time field. Try something like

 index="x" | rex field=_raw "Release Name: (?<release_name>[^\s]+)" | stats distinct_count(hosts) by release_name, instance

You may want to review the docs at http://www.splunk.com/base/Documentation/4.0.10/Knowledge/Addfieldsatsearchtime

View solution in original post

dwaddle
SplunkTrust
SplunkTrust

Use a regular expression (regex) to extract this as a search-time field. Try something like

 index="x" | rex field=_raw "Release Name: (?<release_name>[^\s]+)" | stats distinct_count(hosts) by release_name, instance

You may want to review the docs at http://www.splunk.com/base/Documentation/4.0.10/Knowledge/Addfieldsatsearchtime

Get Updates on the Splunk Community!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...