typesense icon indicating copy to clipboard operation
typesense copied to clipboard

All log events go to stderr.

Open snorrid opened this issue 5 years ago • 3 comments

Description

When running Typesense 0.21 all console output is directed to stderr. This makes it difficult in a Kubernetes environment to distinguish errors from logging event.

It seems the GLOG library used for logging doesn't support sending to anything but stderr.

Steps to reproduce

docker run -p 8108:8108 -v/tmp/data:/data typesense/typesense:0.21.0 --data-dir /data --api-key=Hu52dwsas2AdxdE 2> stderr.log This will output stderr events to a file. As you can see everything is stderr.

Expected Behavior

Log Info/Warning to stdout and errors to stderr.

Actual Behavior

Everything is logged to stderr.

Metadata

Typsense Version: 0.21

snorrid avatar Aug 19 '21 16:08 snorrid

@snorrid Thanks for reporting this issue. I looked into this in detail. Unfortunately, GLOG supports log level separation only for files. For console logging, it gives only two options:

a) Send only ERROR logs to stderr (default) b) Send both INFO and ERROR logs to stderr (which is what we have configured Typesense with)

I've created an issue on Glog.

For now, you might have to rely on a log aggregator for alerting that can differentiate between INFO and ERROR logs based on a regexp parsing configuration.

kishorenc avatar Aug 20 '21 03:08 kishorenc

Note to self: FLAGS_logtostderr is now available on Glog (PR) so this issue is now fixable. Will require rebuilding Typesense and its dependencies with a version of Glog that contains that patch.

kishorenc avatar Jul 04 '22 08:07 kishorenc

Fixed by https://github.com/typesense/typesense/commit/cad2d802e8c8cd98dc073e594715876a9d50307a and will be available in v0.25 when released.

kishorenc avatar Jun 30 '23 05:06 kishorenc