Splunk Search

Get count of rows from a value which is a part of the message in the log file

smarak_das01
New Member

Our requirement is to get the count and location of a build that has been downloaded multiple times from one source file(builddwnld). These location of the builds are retrieved from another source file(buildupld).
For exa:
index="buildupld" status=200 | top 200 location | table location
This gives the output as location "abc/content/buildabc".

But in builddwnld source file, there are no field as location, but we get the whole log file row message in which location is just a part of a big string in the log. For exa :
index="builddwnld" "abc/content/buildabc"
This query gives the below output:-
[24/Aug/2014:23:48:41 -0700] 0 "GET /content/downloads/abc/content/buildabc/abc287.pkg HTTP/1.1" 200 50

If we do index="builddwnld" "abc/content/buildabc" | stats count then it gives just the count.

So, basically we need to form one single query in which we need to use the location value(which we get from the first query from buildupld source) as the input parameter to get the count of the number of times it has been downloaded and the location from builddwnld source(Final output should contain 2 columns count and location).

Kindly help us out to resolve this issue.

Tags (1)
0 Karma

somesoni2
Revered Legend

Try this (slow, using map command)

index="buildupld" status=200 | top 200 location | table location 
| map maxsearches=20 search="index=builddwnld \"$location$\"" | eval location=\"$location\"  | stats count by location"
0 Karma

smarak_das01
New Member

Yes, the URI path value always has this specific pattern, i.e.
/content/downloads/abc/content/buildabc/abc287.pkg
and the location value always starts with the 3rd folder in the path.

0 Karma

somesoni2
Revered Legend

Also, is there any specific pattern about the uri_path value ( /content/downloads/abc/content/buildabc/abc287.pkg) in builddwnld index data, like its always has "/content/downloads/" before location OR the location value "/abc/content/buildabc" always starts with 3rd folder in the path?

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...