container-exception-logger man page

container-exception-logger — log from a container to a host

Synopsis

container-exception-logger [--no-tag | --tag TAG | --help]

Description

A tool designed to run inside of a container which can get its input outside of the container.

--no-tag

do not add tag container-exception-logger at the beginning of log message

--tag TAG

define your own tag which will be added at the beginning of log message

Input Format Specification

It’s possible to use whatever format of a message you want. Openshift logging system (fluentd) and ABRT use JSON. For this reason, we recommend using JSON too.

Mandatory elements

Tools which parse container-exception-logger messages expecting the messages contain following elements:

type

string - exception type - Python, Python3, Ruby, etc.

executable

string - the executable which caused the problem

reason

string - the reason for the problem

backtrace

string - the backtrace of the problem

time

int - seconds since 1970-01-01 00:00:00 UTC

Optional elements

Additional elements can be added without any limitation. For instance pid, uid, msg, etc.

Examples

Example of an input message:

{"type": "Python3", "executable": "/usr/bin/will_python3_raise", "reason":
"will_python3_raise:3:<module>:ZeroDivisionError: division by zero",
"backtrace": "will_python3_raise:3:<module>:ZeroDivisionError: division by
zero\n\nTraceback (most recent call last):\n  File
\"/usr/bin/will_python3_raise\", line 3, in <module>\n", "time": 1521454815,
"pid": 23}

Example of the tool usage (MSG variable represents the message above):

Container:
 $ echo $MSG | container-exception-logger
Host's log:
 Mar 19 14:59:04 localhost dockerd-current[981]: container-exception-logger - $MSG
Container:
 $ echo $MSG | container-exception-logger --no-tag
Host's log:
 Mar 19 15:00:27 localhost dockerd-current[981]: $MSG
Container:
 $ echo $MSG | container-exception-logger --tag new-tag
Host's log:
 Mar 19 15:00:27 localhost dockerd-current[981]: new-tag - $MSG

Authors

Info

07/12/2018