Monitor Type: telegraf/tail
(Source)
Accepts Endpoints: No
Multiple Instances Allowed: Yes
This monitor is based on the Telegraf tail plugin. The monitor tails files and
named pipes. The Telegraf parser configured with this monitor extracts metrics in different
formats
from the tailed output. More information about the Telegraf plugin
can be found here.
All metrics emitted from this monitor will have the plugin
dimension set to telegraf-tail
Sample YAML configuration:
monitors:
- type: telegraf/tail
files:
- '/logs/**.log' # find all .log files in /logs
- '/logs/*/*.log' # find all .log files who are contained in a directory under /logs/
- '/var/log/agent.log' # tail the specified log file
watchMethod: inotify # specify the file watch method ("ionotify" or "poll")
Sample YAML configuration that specifies a parser:
monitors:
- type: telegraf/tail
files:
- '/logs/**.log' # find all .log files in /logs
- '/logs/*/*.log' # find all .log files who are contained in a directory under /logs/
- '/var/log/agent.log' # tail the specified log file
watchMethod: inotify # specify the file watch method ("inotify" or "poll")
telegrafParser: # specify a parser
dataFormat: "influx" # set the parser's dataFormat
To activate this monitor in the Smart Agent, add the following to your agent config:
monitors: # All monitor config goes under this key
- type: telegraf/tail
... # Additional config
For a list of monitor options that are common to all monitors, see Common Configuration.
Config option | Required | Type | Description |
---|---|---|---|
files |
yes | list of strings |
Paths to files to be tailed |
watchMethod |
no | string |
Method for watching changes to files ("ionotify" or "poll") (default: poll ) |
pipe |
no | bool |
Indicates if the file is a named pipe (default: false ) |
fromBeginning |
no | bool |
Whether to start tailing from the beginning of the file (default: false ) |
telegrafParser |
no | object (see below) |
telegrafParser is a nested object that defines configurations for a Telegraf parser. Please refer to the Telegraf documentation for more information on Telegraf parsers. |
The nested telegrafParser
config object has the following fields:
Config option | Required | Type | Description |
---|---|---|---|
dataFormat |
no | string |
dataFormat specifies a data format to parse: json , value , influx , graphite , value , nagios , collectd , dropwizard , wavefront , grok , csv , or logfmt . (default: influx ) |
defaultTags |
no | map of strings |
defaultTags are tags that will be added to all metrics. (json , value , graphite , collectd , dropwizard , wavefront , grok , csv and logfmt only) |
metricName |
no | string |
metricName applies to (json and value ). This will be the name of the measurement. |
dataType |
no | string |
dataType specifies the value type to parse the value to: integer , float , long , string , or boolean . (value only) |
JSONTagKeys |
no | list of strings |
A list of tag names to fetch from JSON data. (json only) |
JSONStringFields |
no | list of strings |
A list of fields in JSON to extract and use as string fields. (json only) |
JSONNameKey |
no | string |
A path used to extract the metric name in JSON data. (json only) |
JSONQuery |
no | string |
A gjson path for json parser. (json only) |
JSONTimeKey |
no | string |
The name of the timestamp key. (json only) |
JSONTimeFormat |
no | string |
Specifies the timestamp format. (json only) |
separator |
no | string |
Separator for Graphite data. (graphite only). |
templates |
no | list of strings |
A list of templates for Graphite data. (graphite only). |
collectdAuthFile |
no | string |
The path to the collectd authentication file (collectd only) |
collectdSecurityLevel |
no | string |
Specifies the security level: none (default), sign , or encrypt . (collectd only ) |
collectdTypesDB |
no | list of strings |
A list of paths to collectd TypesDB files. (collectd only) |
collectdSplit |
no | string |
Indicates whether to separate or join multivalue metrics. (collectd only) |
dropwizardMetricRegistryPath |
no | string |
An optional gjson path used to locate a metric registry inside of JSON data. The default behavior is to consider the entire JSON document. (dropwizard only) |
dropwizardTimePath |
no | string |
An optional gjson path used to identify the drop wizard metric timestamp. (dropwizard only) |
dropwizardTimeFormat |
no | string |
The format used for parsing the drop wizard metric timestamp. The default format is time.RFC3339. (dropwizard only) |
dropwizardTagsPath |
no | string |
An optional gjson path used to locate drop wizard tags. (dropwizard only) |
dropwizardTagPathsMap |
no | map of strings |
A map of gjson tag names and gjson paths used to extract tag values from the JSON document. This is only used if dropwizardTagsPath is not specified. (dropwizard only) |
grokPatterns |
no | list of strings |
A list of patterns to match. (grok only) |
grokNamedPatterns |
no | list of strings |
A list of named grok patterns to match. (grok only) |
grokCustomPatterns |
no | string |
Custom grok patterns. (grok only) |
grokCustomPatternFiles |
no | list of strings |
List of paths to custom grok pattern files. (grok only) |
grokTimezone |
no | string |
Specifies the timezone. The default is UTC time. Other options are Local for the local time on the machine, UTC , and Canada/Eastern (unix style timezones). (grok only) |
CSVDelimiter |
no | string |
The delimiter used between fields in the csv. (csv only) |
CSVComment |
no | string |
The character used to mark rows as comments. (csv only) |
CSVTrimSpace |
no | bool |
Indicates whether to trim leading white from fields. (csv only) (default: false ) |
CSVColumnNames |
no | list of strings |
List of custom column names. All columns must have names. Unnamed columns are ignored. This configuration must be set when CSVHeaderRowCount is 0. (csv only) |
CSVColumnTypes |
no | list of strings |
List of types to assign to columns. Acceptable values are int , float , bool , or string (csv only). |
CSVTagColumns |
no | list of strings |
List of columns that should be added as tags. Unspecified columns will be added as fields. (csv only) |
CSVMeasurementColumn |
no | string |
The name of the column to extract the metric name from (csv only) |
CSVTimestampColumn |
no | string |
The name of the column to extract the metric timestamp from. CSVTimestampFormat must be set when using this option. (csv only) |
CSVTimestampFormat |
no | string |
The format to use for extracting timestamps. (csv only) |
CSVHeaderRowCount |
no | integer |
The number of rows that are headers. By default no rows are treated as headers. (csv only) (default: 0 ) |
CSVSkipRows |
no | integer |
The number of rows to ignore before looking for headers. (csv only) (default: 0 ) |
CSVSkipColumns |
no | integer |
The number of columns to ignore before parsing data on a given row. (csv only) (default: 0 ) |
The agent does not do any built-in filtering of metrics coming out of this monitor.