Splunk Search

New line with count eval match

levent_kurt
Explorer

Hi,

I did a search of search engine bots and divide them by number and take their total calls.
This one is for google. Now I try to add also a new line on the result and print also yandex, yahoo, bing but i can not make them write on the new line with the same result. How can i do it?

sourcetype="access_*" |stats count(eval(match(useragent, "Googlebot/2.1"))) as "Googlebot/2.1",count(eval(match(useragent, "Googlebot-News"))) as "Googlebot-News",count(eval(match(useragent, "Googlebot-Image/1.0"))) as "Googlebot-Image/1.0" ,count(eval(match(useragent, "Googlebot-Video/1.0"))) as "Googlebot-Video/1.0",count(eval(match(useragent, "Googlebot-Mobile/2.1"))) as "Googlebot-Mobile/2.1",count(eval(match(useragent, "Google Web Preview"))) as "Google Web Preview", count(eval(match(useragent, "Feedfetcher-Google"))) as "Feedfetcher-Google"| eval "Google_TOTAL"='Googlebot/2.1'+'Googlebot-News'+'Googlebot-Image/1.0'+'Googlebot-Video/1.0'+'Googlebot-Mobile/2.1'+'Google Web Preview'+'Feedfetcher-Google'
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

You can concatenate the output lines for different search engines (e.g. Google_TOTAL, Yahoo_TOTAL etc), using a delimiter and split the final string using that delimiter. The splitted string will be a multivalued field and all TOTAL will appear in new line.

e.g.

your search generating TOTAL fields like Google_TOTAL,Yahoo_TOTAL,Bing_TOTAL | eval TOTAL=split(Google_TOTAL."##".Yahoo_TOTAL."##".Bing_TOTAL, "##")

View solution in original post

0 Karma

somesoni2
SplunkTrust
SplunkTrust

You can concatenate the output lines for different search engines (e.g. Google_TOTAL, Yahoo_TOTAL etc), using a delimiter and split the final string using that delimiter. The splitted string will be a multivalued field and all TOTAL will appear in new line.

e.g.

your search generating TOTAL fields like Google_TOTAL,Yahoo_TOTAL,Bing_TOTAL | eval TOTAL=split(Google_TOTAL."##".Yahoo_TOTAL."##".Bing_TOTAL, "##")
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...