out_exec
TimeSliced Output plugin passes events to an external program. The program receives the path to a file containing the incoming events as its last argument. The file format is tab-separated values (TSV) by default.out_exec
.ARGV[-1]
). The following script fizzbuzz.py
runs FizzBuzz against the new-line delimited sequence of natural numbers (1, 2, 3...) and writes the output to foobar.out
:out_exec
(as well as out_exec_filter
and in_exec
), the program can be written in any language, not just Ruby.@type tsv
and keys fizzbuzz
in <format>
tells Fluentd to extract the fizzbuzz
field and output it as TSV. This simple example has a single key, but you can of course extract multiple fields and use format json
to output newline-delimited JSON./path/to/buffer_path
, and the command python /path/to/fizzbuzz.py /path/to/buffer_path
is run. This is why in fizzbuzz.py
, it is reading the file at sys.argv[-1]
.foobar.out
:@type
exec
.command
exec
plugin passes the path of flushed buffer chunk as the last argument.command
parameter like this:cmd
does not exist in PATH, you need to specify the absolute path, e.g. /path/to/cmd
.command_timeout
<format>
Section@type
<inject>
Sectiontime_type
localtime
<buffer>
Sectiondelayed_commit_timeout