109.10. External Programs (im_exec)
This module will execute a program or script on startup and read its standard output. It can be used to easily integrate with exotic log sources which can be read only with the help of an external script or program.
Warning
|
If you are using a Perl script, consider using im_perl
instead or turning on Autoflush with $| = 1; , otherwise im_exec
might not receive data immediately due to Perl’s internal
buffering. See the Perl language
reference for more information about $| .
|
109.10.1. Configuration
The im_exec module accepts the following directives in addition to the common module directives. The Command directive is required.
- Command
-
This mandatory directive specifies the name of the program or script to be executed.
- InputType
-
See the InputType description in the global module configuration section.
- Restart
-
Restart the process if it exits. There is a one second delay before it is restarted to avoid a denial-of-service when a process is not behaving. Looping should be implemented in the script itself, this directive is only to provide some safety against malfunctioning scripts and programs. This boolean directive defaults to FALSE: the Command will not be restarted if it exits.
109.10.2. Examples
This configuration uses the tail command to read from a file.
Note
|
The im_file module should be used to read log messages from files. This example only demonstrates the use of the im_exec module. |