Splunk Search

Combining Two Fields For Searching

henryt1
Path Finder

So I'm trying to run a search in Splunk and have two fields combined to return one larger field. My basic search is:

(host="web01.inno-360.com" AND source="/var/log/apache2/basf_ssl_access.log" AND "/profile-services/talent") OR (host="zakta01.inno-360.com" AND basf-landscaping.inno-360.com AND "GET /search" AND query=*)

From that I'm interested in two fields: 1) 'query' 2) 'q'. I would like to combine these two fields to end with something like:

... | stats count by newField

From searching I have tried using eval like this:

... | eval newField= query." ".q | stats count by newField

However I've had absolutely no luck at all with this. Any help with this would be greatly appreciated.

Tags (3)
0 Karma

sdaniels
Splunk Employee
Splunk Employee

Your eval statement is fine. You need to fix the stats count. This should do it.

. | eval newField= query." ".q | stats count(newField)

Then you could do | stats count(newField) by newField

0 Karma
Get Updates on the Splunk Community!

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...