The head input plugin, allows to read events from the head of file. It's behavior is similar to the head command.
Configuration Parameters
The plugin supports the following configuration parameters:
Key
Description
File
Absolute path to the target file, e.g: /proc/uptime
Buf_Size
Buffer size to read the file.
Interval_Sec
Polling interval (seconds).
Interval_NSec
Polling interval (nanosecond).
Add_Path
If enabled, filepath is appended to each records. Default value is false.
Key
Rename a key. Default: head.
Lines
Line number to read. If the number N is set, in_head reads first N lines like head(1) -n.
Split_line
If enabled, in_head generates key-value pair per line.
Threaded
Indicates whether to run this input in its own thread. Default: false.
Split Line Mode
This mode is useful to get a specific line. This is an example to get CPU frequency from /proc/cpuinfo.
/proc/cpuinfo is a special file to get cpu information.
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz
stepping : 7
microcode : 41
cpu MHz : 2791.009
cache size : 4096 KB
physical id : 0
siblings : 1
Cpu frequency is "cpu MHz : 2791.009". We can get the line with this configuration file.
[INPUT] Name head Tag head.cpu File /proc/cpuinfo Lines 8 Split_line true# {"line0":"processor : 0", "line1":"vendor_id : GenuineIntel" ...}[FILTER] Name record_modifier Match * Whitelist_key line7[OUTPUT] Name stdout Match *