Splunk Search

Howto Chart Fields by Host

muebel
SplunkTrust
SplunkTrust

I am indexing results from facter which logs information about each host. I can get the most up to date list of these system properties by running

sourcetype="puppet-facts" | dedup host

This would return a single event for each host. My question is, how would I generate a table that would include a record for each host, and then columns consisting of the fields?

0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee
sourcetype=puppet-facts 
| stats 
    first(field1) as field1 
    first(field2) as field2 
    first(field3) as field3
    count
    sum(field4) as total_amt
    ...
  by host

View solution in original post

0 Karma

gkanapathy
Splunk Employee
Splunk Employee
sourcetype=puppet-facts 
| stats 
    first(field1) as field1 
    first(field2) as field2 
    first(field3) as field3
    count
    sum(field4) as total_amt
    ...
  by host
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

sourcetype=puppet-facts | dedup host | table *

0 Karma

muebel
SplunkTrust
SplunkTrust

This works out nicely if I have a small amount of fields to create the table as I described. Do you know of a way to do the same thing for all fields? Other than just hardcoding it into the searchstring?

0 Karma

Simeon
Splunk Employee
Splunk Employee

Let's assume you have multiple fields values in your "puppet-facts" including duration and status. To chart any of these in combination with host, you could do the following search:

sourcetype="puppet-facts" | dedup host | chart count by host,duration,status

The above search uses the chart command to create a listing of the vent count with the host, duration, and status fields.

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...