Document distinction between file and tail inputs (#7353)
This commit is contained in:
parent
795750a7a0
commit
be1dc49ad9
|
@ -1,22 +1,18 @@
|
||||||
# File Input Plugin
|
# File Input Plugin
|
||||||
|
|
||||||
The file plugin updates a list of files every interval and parses the contents
|
The file plugin parses the **complete** contents of a file **every interval** using
|
||||||
using the selected [input data format](/docs/DATA_FORMATS_INPUT.md).
|
the selected [input data format][].
|
||||||
|
|
||||||
Files will always be read in their entirety, if you wish to tail/follow a file
|
**Note:** If you wish to parse only newly appended lines use the [tail][] input
|
||||||
use the [tail input plugin](/plugins/inputs/tail) instead.
|
plugin instead.
|
||||||
|
|
||||||
### Configuration:
|
### Configuration:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[inputs.file]]
|
[[inputs.file]]
|
||||||
## Files to parse each interval.
|
## Files to parse each interval. Accept standard unix glob matching rules,
|
||||||
## These accept standard unix glob matching rules, but with the addition of
|
## as well as ** to match recursive files and directories.
|
||||||
## ** as a "super asterisk". ie:
|
files = ["/tmp/metrics.out"]
|
||||||
## /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"]
|
|
||||||
|
|
||||||
## Data format to consume.
|
## Data format to consume.
|
||||||
## Each data format has its own unique set of configuration options, read
|
## 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.
|
## to disable.
|
||||||
# file_tag = ""
|
# file_tag = ""
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[input data format]: /docs/DATA_FORMATS_INPUT.md
|
||||||
|
[tail]: /plugins/inputs/tail
|
||||||
|
|
|
@ -20,13 +20,9 @@ type File struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const sampleConfig = `
|
const sampleConfig = `
|
||||||
## Files to parse each interval.
|
## Files to parse each interval. Accept standard unix glob matching rules,
|
||||||
## These accept standard unix glob matching rules, but with the addition of
|
## as well as ** to match recursive files and directories.
|
||||||
## ** as a "super asterisk". ie:
|
files = ["/tmp/metrics.out"]
|
||||||
## /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"]
|
|
||||||
|
|
||||||
## The dataformat to be read from files
|
## The dataformat to be read from files
|
||||||
## Each data format has its own unique set of configuration options, read
|
## 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 {
|
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 {
|
func (f *File) Gather(acc telegraf.Accumulator) error {
|
||||||
|
|
|
@ -100,7 +100,7 @@ func (t *Tail) SampleConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tail) Description() 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 {
|
func (t *Tail) Init() error {
|
||||||
|
|
Loading…
Reference in New Issue