Splunk Search

Time chart - Multiple specific field values possible?

srw46
Path Finder

Hello all,

I'm trying to create a report that compares the number of transactions (from the same system) between different hosts within that system. So far I can use the timechart, count and eval commands/functions to display for one host but I've been unable to do it for multiple host.

Here is what I'm currently using:

(host="host1" OR host="host2" OR host="host3" OR host="host4" OR host="host5" OR host="host6" AND system_id="system") | timechart count | eval host="host1"

I've tried using additional eval, timechart and count commands but it just seems to resolve the 'latest' one and only that one. Any suggestions please?

As an additional question, when I create the report from the search results instead of plotting the host as 'host1' it is just listing it as 'count'. I'm sure this is straightforward to a lot of you, but how can I change this? I am very new to this 🙂

Many thanks in advance

Tags (3)
0 Karma
1 Solution

Ayn
Legend

If I understand you correctly, you want to make timechart break up the count by host? In that case, that's easy. timechart supports it using the "by" parameter:

(host="host1" OR host="host2" OR host="host3" OR host="host4" OR host="host5" OR host="host6" AND system_id="system") | timechart count by host

As a bonus you will also solve your second problem - instead of "count" Splunk will display the value of the "host" field when charting for multiple values. That said, if you're still curious how to change the title from "count" to something else, use "as":

timechart count AS yourtitle by host

As for setting it dynamically to some field value when just charting for a single field, I'm unaware of a way to do that.

View solution in original post

Ayn
Legend

If I understand you correctly, you want to make timechart break up the count by host? In that case, that's easy. timechart supports it using the "by" parameter:

(host="host1" OR host="host2" OR host="host3" OR host="host4" OR host="host5" OR host="host6" AND system_id="system") | timechart count by host

As a bonus you will also solve your second problem - instead of "count" Splunk will display the value of the "host" field when charting for multiple values. That said, if you're still curious how to change the title from "count" to something else, use "as":

timechart count AS yourtitle by host

As for setting it dynamically to some field value when just charting for a single field, I'm unaware of a way to do that.

srw46
Path Finder

Thank you Ayn. This is what I wanted. Embarassingly straightforward it seems 🙂

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...