exec
Last updated
Was this helpful?
Last updated
Was this helpful?
The in_exec
Input plugin executes external programs to receive or pull event logs. It will then read TSV (tab-separated values), JSON or MessagePack from the standard output of the program.
You can run a program periodically or permanently. To run periodically, please use the run_interval
parameter.
It is included in Fluentd's core.
@type
The value must be exec
.
command
type
default
version
string
required parameter
0.14.0
The command (program) to execute.
tag
type
default
version
string
required if extract
/tag_key
is not specified
0.14.0
The tag of the output events.
run_interval
type
default
version
time
nil
0.14.0
The interval time between periodic program runs. If not specified, command script runs only once.
read_block_size
type
default
version
size
10240
0.14.9
The default block size to read if parser requires partial read.
connect_mode
type
default
available values
version
enum
read
read
/read_with_stderr
1.11.3
Control target IO:
read
: Read logs from stdio
read_with_stderr
: Read logs from stdio and stderr.
read_with_stderr
is mainly for debug.
<parse>
sectionrequired
multi
version
false
false
0.14.9
Refer these for more details about parse
section:
@type
type
default
version
string
tsv
0.14.9
Overwrites the default value in this plugin.
time_type
type
default
version
string
float
0.14.9
Overwrites the default value in this plugin.
time_key
type
default
version
string
nil
0.14.9
Overwrites the default value in this plugin.
estimate_current_event
type
default
version
bool
false
0.14.9
Overwrites the default value in this plugin.
<extract>
Sectionrequired
multi
version
false
false
0.14.9
time_type
type
default
version
string
float
0.14.9
Overwrites the default value in this plugin.
Here is a simple example to fetch load average stats on Linux systems. This configuration instructs Fluentd to read /proc/loadavg
once per minute and emit the file content as events.
This configuration emits events like this one:
If you already have a script that runs periodically (say, via cron
) that you wish to store the output to multiple backend systems (HDFS, AWS, Elasticsearch, etc.), in_exec
is a great choice.
The only requirement for the script is that it outputs TSV, JSON or MessagePack.
Suppose that script is called hn.rb
. Then, you can run it every 5 minutes with the following configuration:
And if you run Fluentd with it, you will see the following output (if you are impatient, CTRL+C
to flush the stdout buffer):
Refer to the article for the basic structure and syntax of the configuration file.
See .
See .
For example, this scrapes the front page of and scrapes information about each post:
Of course, you can use Fluentd's many output plugins to store the data into various backend systems like , , , , etc.
If this article is incorrect or outdated, or omits critical information, please . is an open-source project under . All components are available under the Apache 2 License.