A lightweight container that monitors a host directory and ships the log files within it to Logz.io. Also available is the possibility to ship a single file.
Log files can contain either line based logs or JSON formatted logs.
This image is based on the Alpine Linux distribution and has rsyslog 8.9 installed.
- A valid Logz.io customer authentication token (which can be obtained with a trial account from Logz.io)
How to use this image
The following environment variables are available:
A valid Logz.io customer authentication token. (required)
The Logz.io listener address. (optional)
The log type that is being sent. This enables better parsing of your log data. (required)
File path to monitor. The file path is **relative** to the mounted/mapped folder. If missing, the value will default to the mounted folder. The path can be to a single file or directory. wildcards are allowed only on the file name. for more details please see Rsyslog documentation
The file content codec, currently supported codec types are "text" and "json". The default is "text".
Host file mapping
In order to ship a log file, it has to be mapped to the running container.
This is performed with the -v option
-v <log file or directory to ship>:/var/log/logzio
docker run \ -d \ --name rsyslog-shipper \ -v /PATH/TO/FOLDER:/var/log/logzio \ -e LOGZIO_USER_TOKEN="USER_TOKEN" \ -e MONITOR_FILE_PATH="PATH_TO_LOG_FILE" \ -e MONITOR_FILE_TYPE="FILE_TYPE" \ -e CODEC="FILE_CODEC" \ logzio/logzio-rsyslog-shipper:latest
This example monitors all files under the mounted folder.
All files are assumed to be plain text log files.
docker run \ -d \ --name logzio-rsyslog-shipper \ -v /var/logs/apache2:/var/log/logzio \ -e LOGZIO_USER_TOKEN="USER_TOKEN" \ -e MONITOR_FILE_TYPE="apache" \ logzio/logzio-rsyslog-shipper:latest
This example monitors the myapp log files, The path to the files is relative to the mounted folder.
All files are assumed to be json log files.
docker run \ -d \ --name logzio-rsyslog-shipper \ -v /home/ubuntu/myapp:/var/log/logzio \ -e LOGZIO_USER_TOKEN="USER_TOKEN" \ -e MONITOR_FILE_PATH="logs/*.json" \ -e MONITOR_FILE_TYPE="myapp" \ -e CODEC="json" \ logzio/logzio-rsyslog-shipper:latest