The Head input plugin reads events from the head of a file. Its 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. For example: /proc/uptime.
Buf_Size
Buffer size to read the file.
Interval_Sec
Polling interval (seconds).
Interval_NSec
Polling interval (nanoseconds).
Add_Path
If enabled, the path is appended to each records. Default: 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
Split line mode
Use this mode to get a specific line. The following example gets 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
The CPU frequency is cpu MHz : 2791.009. The following configuration file gets the needed line:
[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 *