Skip to main content
Sumo Logic

Collect Metrics with Telegraf

Telegraf is a plugin-driven server agent for collecting and reporting metrics. Like CollectD, Logstash, and FluentD, it follows the input->output flow. It consists of numerous Input Plugins to read metrics from various systems, and numerous Output Plugins to send your data to. While Sumo Logic does not currently have an output plugin, there are multiple existing plugins that can be used to deliver data to Sumo Logic.

Using the Graphite Output

Telegraf has a Graphite Output plugin that can deliver metrics to Sumo Logic. Using an Installed Collector with a Graphite Source, Telegraf can be configured to send data to the Graphite Source in Sumo Logic. The flow is as follows:

  1. Set up an Installed Collector with a Streaming Metrics Source.
  2. Set up Telegraf to Output data to that Streaming Metrics Source.

The following is an example configuration for the Telegraf agent using the Graphite Output plugin:

[[outputs.graphite]]
  servers = ["localhost:2003"]
  data_format = "graphite"

In the above configuration, any data flowing into Telegraf from their many Input Plugins can be sent to Sumo Logic. In this example, the servers property is the URL to the Installed Collector. In this case, we assume the Telegraf agent and Sumo collector are on the same box, but they do not have to be. The data_format should be set to graphite so the Installed Collector can properly ingest the data from Telegraf. See the Graphite Output plugin for details on other configurable parameters.

Using the HTTP Output

Telegraf has an HTTP Output plugin that can deliver metrics to Sumo Logic. Using a Hosted Collector with an HTTP Source, Telegraf can be configured to send data to the HTTP Source in Sumo Logic. The flow is as follows:

  1. Set up a Hosted Collector with an HTTP Source.
  2. Set up Telegraf to output data to the HTTP Source.

The following is an example configuration for the Telegraf agent using the HTTP Output plugin:

[[outputs.http]]
 url = "https://collectors.sumologic.com/receiver/v1/http/XXXXXXXXXX"
 data_format = "graphite"
 [outputs.http.headers]
   Content-Type = "application/vnd.sumologic.graphite"
   X-Sumo-Category = “prod/someapp/metrics”

In the above configuration, any data flowing into Telegraf from their many Input Plugins can be sent to Sumo Logic. In this example, the url property is the URL to the HTTP Source. The data_format should be set to graphite so the Installed Collector can properly ingest the data from Telegraf. We also set some additional headers. The Content-Type header is required to tell the Sumo Logic HTTP Source that it is receiving Graphite data. We can also set additional headers to control the Sumo Logic metadata. The example set the X-Sumo-Category field to prod/someapp/metrics so in Sumo Logic, we can find these metrics using _sourceCategory=prod/someapp/metrics.