# README
socker2stdout
Listen on a TCP or Unix socket and send to stdout.
Why?
This was written to handle wanting to write to stdout from inside a container from a PHP application. However, php-fpm prefixes each line with a preamble. So, this allows one to configure PHP loggers - such as monolog - to log to a tcp socket and still capture stdout.
socket2stdout handles log lines greater than PIPE_BUF. Some tools may interleave lines with large messages.
Usage
$ ./socket2stdout -h
copy lines from a socket to stdout
Usage:
socket2stdout [flags]
Flags:
--addr string tcp address (default "127.0.0.1:4444")
--aux-addr string listen address for aux handler. metrics, healthchecks, etc (default ":9090")
--unix string unix address. takes precedence if both unix and tcp are set
An example using monolog to log to this socket:
$logger = new Monolog\Logger("example");
$handler = new Monolog\Handler\SocketHandler('tcp://127.0.0.1:1313');
$formatter = new Monolog\Formatter\JsonFormatter();
$handler->setFormatter($formatter);
$logger->pushHandler($handler);
Building
go build .
Also availible at https://quay.io/repository/bakins/socket2stdout
# Packages
No description provided by the author
# Functions
New creates a new server.
SetAuxAddress will set the address for the metrics listener.
SetTCPAddress will set the TCP address to accept line oriented data.
SetUnixAddress will set the Unix address to accept line oriented data.
# Type aliases
OptionsFunc is a function passed to new for setting options on a new server.