Document distinction between file and tail inputs (#7353)

This commit is contained in:
Daniel Nelson 2020-04-24 16:40:08 -07:00 committed by GitHub
parent 795750a7a0
commit be1dc49ad9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 20 deletions

View File

@ -1,22 +1,18 @@
# File Input Plugin
The file plugin updates a list of files every interval and parses the contents
using the selected [input data format](/docs/DATA_FORMATS_INPUT.md).
The file plugin parses the **complete** contents of a file **every interval** using
the selected [input data format][].
Files will always be read in their entirety, if you wish to tail/follow a file
use the [tail input plugin](/plugins/inputs/tail) instead.
**Note:** If you wish to parse only newly appended lines use the [tail][] input
plugin instead.
### Configuration:
```toml
[[inputs.file]]
## Files to parse each interval.
## These accept standard unix glob matching rules, but with the addition of
## ** as a "super asterisk". ie:
## /var/log/**.log -> recursively find all .log files in /var/log
## /var/log/*/*.log -> find all .log files with a parent dir in /var/log
## /var/log/apache.log -> only read the apache log file
files = ["/var/log/apache/access.log"]
## Files to parse each interval. Accept standard unix glob matching rules,
## as well as ** to match recursive files and directories.
files = ["/tmp/metrics.out"]
## Data format to consume.
## Each data format has its own unique set of configuration options, read
@ -28,3 +24,6 @@ use the [tail input plugin](/plugins/inputs/tail) instead.
## to disable.
# file_tag = ""
```
[input data format]: /docs/DATA_FORMATS_INPUT.md
[tail]: /plugins/inputs/tail

View File

@ -20,13 +20,9 @@ type File struct {
}
const sampleConfig = `
## Files to parse each interval.
## These accept standard unix glob matching rules, but with the addition of
## ** as a "super asterisk". ie:
## /var/log/**.log -> recursively find all .log files in /var/log
## /var/log/*/*.log -> find all .log files with a parent dir in /var/log
## /var/log/apache.log -> only read the apache log file
files = ["/var/log/apache/access.log"]
## Files to parse each interval. Accept standard unix glob matching rules,
## as well as ** to match recursive files and directories.
files = ["/tmp/metrics.out"]
## The dataformat to be read from files
## Each data format has its own unique set of configuration options, read
@ -45,7 +41,7 @@ func (f *File) SampleConfig() string {
}
func (f *File) Description() string {
return "Reload and gather from file[s] on telegraf's interval."
return "Parse a complete file each interval"
}
func (f *File) Gather(acc telegraf.Accumulator) error {

View File

@ -100,7 +100,7 @@ func (t *Tail) SampleConfig() string {
}
func (t *Tail) Description() string {
return "Stream a log file, like the tail -f command"
return "Parse the new lines appended to a file"
}
func (t *Tail) Init() error {