Splunk Search

logging multiple metrics for time series

drgonzo65
Engager

I have a series of metrics that get dumped to a file every minute in this format:

timestamp:XXXXXXXXXX metric1:XX metric2:XX metric3:XX

The Xs represent numerical values for each metric. There are about 550 metrics in that file, so I'm wondering what is the best way to index and report on them in Splunk? I have tried doing linebreaks on the space, and then it parses the metric names correctly, but 1) it seems to slow down the search app because there are so many events and 2) it doesn't make searching for them any easier. I would like to run a large number of timecharts against this data, but it seems rather unwieldy, as I have to type something like "| timechart avg(metric_with_very_long_name_1), avg(metric_with_very_long_name_2)" and autocomplete doesn't even show once you are specifying inputs to the timechart. We need to very quickly create ad-hoc charts for multiple metrics at once, and I don't see how that will be so easy.

Does anyone know if I'm doing this incorrectly? It seems like it should be easier to plot time-series data from a dataset like this.

southeringtonp
Motivator

1) Field Extraction

transforms.conf:

[extract-metric]
REGEX=(\S+):(\S+)
FORMAT=$1::$2

props.conf:

[mysourcetype]
REPORT-metric=extract-metric

Or, if you just want search-time results, skip all this and use the extract command as shown below.



2) Timechart Reporting

If your metrics field names follow a pattern, you may be able to use wildcards. For example if they all start with 'metric_', you can do:

| timechart avg(metric_*)

In a real pinch, you can use this (rather ugly) method:

sourcetype=whatever ...
| fields + _time,_raw 
| extract pairdelim=" " kvdelim=: 
| timechart avg(*)

First, filter out all fields except _raw and _time. Then use extract to add back the fields containing your metrics. Now you can use timechart avg(*), since only your metrics fields remain to be matched by the wildcard.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...