Public Repository

Last pushed: 2 years ago
Short Description
Ships all log files form a directory Logz.io
Full Description

logzio-rsyslog-shipper

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.

Requirements

  • 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:

LOGZIO_USER_TOKEN

A valid Logz.io customer authentication token. (required)

LISTENER_HOST

The Logz.io listener address. (optional)

MONITOR_FILE_TYPE

The log type that is being sent. This enables better parsing of your log data. (required)

MONITOR_FILE_PATH

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 

CODEC

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

Run it
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

Exemple

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
Docker Pull Command
Owner
logzio

Comments (0)