NXLog User Guide
- OS Support
- Enterprise Edition Reference Manual
- 146. Man Pages
- 147. Configuration
- 148. Language
- 149. Extension Modules
- 150. Input Modules
- 151. Processor Modules
- 152. Output Modules
- 152.1. Microsoft Azure (om_azure)
- 152.2. Batched compression (om_batchcompress)
- 152.3. Blocker (om_blocker)
- 152.4. DBI (om_dbi)
- 152.5. Elasticsearch (om_elasticsearch)
- 152.6. EventDB (om_eventdb)
- 152.7. Program (om_exec)
- 152.8. File (om_file)
- 152.9. Go (om_go)
- 152.10. HTTP(s) (om_http)
- 152.11. Java (om_java)
- 152.12. Kafka (om_kafka)
- 152.13. Null (om_null)
- 152.14. ODBC (om_odbc)
- 152.15. Perl (om_perl)
- 152.16. Named pipes (om_pipe)
- 152.17. Python (om_python)
- 152.18. Raijin (om_raijin)
- 152.19. Redis (om_redis)
- 152.20. Ruby (om_ruby)
- 152.21. TLS/SSL (om_ssl)
- 152.22. TCP (om_tcp)
- 152.23. UDP (om_udp)
- 152.24. UDP with IP spoofing (om_udpspoof)
- 152.25. Unix domain sockets (om_uds)
- 152.26. WebHDFS (om_webhdfs)
- 152.27. ZeroMQ (om_zmq)
- NXLog Manager
- NXLog Add-Ons
This module will execute a program or script on startup and write
(pipe) log data to its standard input. Unless
OutputType is set to something else,
only the contents of the
$raw_event field are sent over the
pipe. The execution of the program or script will terminate when the
module is stopped, which usually happens when NXLog exits and
the pipe is closed.
|To examine the supported platforms, see the list of installer packages in the Available Modules chapter.|
|The program or script is started when NXLog starts and must not exit until the module is stopped. To invoke a program or script for each log message, use xm_exec instead.|
This mandatory directive specifies the name of the program or script to be executed.Note
Programs, scripts, and commands are executed under the context of the user running NXLog. When NXLog is running as a service, the service user will be used. If the program, script, or command accesses environment variables, make sure that these are available for the NXLog user.
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.
This configuration reads logs from a file and writes the log lines to the standard input of an application. The Command directive specifies the path to the application executable and the Arg directive specifies an application argument.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <Input log_file> Module im_file File '/path/to/log/file' </Input> <Output myapp> Module om_exec Command /path/to/myapp # On Windows the path to the application executable # should include the file extension. #Command C:\Program Files\MyApp\myapp.exe Arg --level=info </Output>
This configuration reads logs from a file and writes the log lines to the
standard output using the Linux
cat command-line tool.
The Command directive specifies the
path to the Linux system shell. The first Arg directive
-c argument to the shell and the second Arg directive specifies
the command to execute.
This configuration reads logs from a file and pipes the log lines to a Python script. The Command directive specifies the path to the Python executable and the Arg directive specifies the path to the script.
To execute commands under a specific shell, the Command directive should specify the path to the shell executable. The commands to execute can be passed as arguments according to the shell being used. The configuration below executes PowerShell commands from a file.