Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize log format of relay proxy #85

Closed
missourian55 opened this issue Jan 7, 2020 · 5 comments
Closed

Standardize log format of relay proxy #85

missourian55 opened this issue Jan 7, 2020 · 5 comments

Comments

@missourian55
Copy link

Relay proxy emits different log formats, is there anyway to standardize the logs to one format and let the timestamps be with milli or micro or nano second precision along with TimeZone? Sorry, coming from Java land and these type of log statements seems non standard.

We are planning to push Relay Proxy logs to Elasticsearch through fluentd/fluentbit and having one standard helps the log aggregation layer.

Sample of Current Logs - Notice two different formats


DEBUG: 2020/01/07 00:17:32 logging.go:143: Request: method=GET url=/all auth=*095f0 status=200 (streaming)

DEBUG: 2020/01/07 00:17:32 logging.go:143: Request: method=GET url=/all auth=*095f0 status=200 (streaming)

[env: test-dev] 2020/01/07 00:17:32 DEBUG: Application requested server-side /all stream
@eli-darkly
Copy link
Contributor

Good point. This wasn't an intentional difference; shouldn't be hard to fix.

@eli-darkly
Copy link
Contributor

Oh... I see why it's that way. Ugh. Go's built-in Logger does not have any notion of "levels", and there is no way to make it prepend a string like "DEBUG:" to every log message that you write; all you can do is prepend a string to the whole line. That's not a desirable format— it would be much better to put the timestamp first— but as long as the loggers are implemented as a log.Logger, we have no other way to make "DEBUG:", "ERROR:", etc. show up unless we hard-code them into every log string. And because Relay is usable as a library inside an application, and those logger instances are exported global variables, changing their type would be a breaking change. So... we may have to just hard-code those prefixes for now. It's clunky but I think it's worth it to make the timestamp be at the beginning of the line.

@eli-darkly
Copy link
Contributor

Ah no, I spoke too soon, it's a pretty easy fix after all.

@eli-darkly
Copy link
Contributor

eli-darkly commented Jan 9, 2020

In the upcoming release, we're planning to standardize the format as follows:

2020/01/06 18:25:59.404164 [env: my-environment-name] DEBUG: Received all feature flags

Messages that aren't tied to a specific environment would omit the [env: xxx] field - although for simplicity in parsing I guess we could instead substitute something like [main]. (Edited to add: the latter.)

LaunchDarklyCI pushed a commit that referenced this issue Jan 9, 2020
add ability to specify CA certs; remove InsecureSkipVerify parameter
@eli-darkly
Copy link
Contributor

The 5.9.2 release includes this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants