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

Request for comments about a LTSV encoder #253

Closed
hnakamur opened this issue Jan 28, 2017 · 5 comments
Closed

Request for comments about a LTSV encoder #253

hnakamur opened this issue Jan 28, 2017 · 5 comments

Comments

@hnakamur
Copy link
Contributor

First of all, thanks for a nice logging library for Go!

I created a Labeled Tab-separated Values (LTSV) encoder for zap.
https://github.com/hnakamur/zap-ltsv

Could you take a look and give some comments to issues?

Thanks for your time in advance.

@akshayjshah
Copy link
Contributor

Awesome - I'm glad to hear that zap was useful for you! I haven't worked with the LTSV encoding before - from the docs, I can see that it's accepted by a variety of logging tools. Are you aware of any common software that emits LTSV logs by default?

I'm going to defer this until after the 1.0 release, since the encoder API is changing (though nearly all the code you have should still work, it'll just require some find&replace updates). Once we've released 1.0, I'll take a closer look at your code and figure out whether we should include it in zap itself.

@hnakamur
Copy link
Contributor Author

Thanks for your kind words.
I don't know anything that emits LTSV logs by default config.
However it is easy to setup Apache or nginx configs to emit LTSV logs.

Apache config example:

LogFormat "host:%h\tident:%l\tuser:%u\ttime:%t\treq:%r\tstatus:%>s\tsize:%b\treferer:\%{Referer}i\tua:%{User-Agent}i" combined_ltsv

nginx config example:

log_format ltsv "time:$time_local"
                "\thost:$remote_addr"
                "\tforwardedfor:$http_x_forwarded_for"
                "\treq:$request"
                "\tstatus:$status"
                "\tsize:$body_bytes_sent"
                "\treferer:$http_referer"
                "\tua:$http_user_agent"
                "\treqtime:$request_time"
                "\tcache:$upstream_http_x_cache"
                "\truntime:$upstream_http_x_runtime"
                "\tvhost:$host";

Also, with Fluentd | Open Source Data Collector | Unified Logging Layer, you can convert logs in other formats to LTSV using Text Formatter Overview | Fluentd.

I understand that you defer this pull request after zap 1.0 release.
I'll update the LTSV encoder for API changes.

Thanks!

@akshayjshah
Copy link
Contributor

Hey @hnakamur - the encoder APIs are stable now, so this is a good time to update your encoder. Since I'm not familiar with this encoding and we don't use it internally, let's keep it in a separate package.

#330 may be relevant to you, though.

@akshayjshah
Copy link
Contributor

Closing this issue, since there's no active work to do in zap.

@hnakamur
Copy link
Contributor Author

hnakamur commented May 4, 2017

Sorry for being late. I noticed your mention yesterday.
I've updated the LTSV encoder at hnakamur/zap-ltsv#5.
Thanks again for a great logging library!

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

No branches or pull requests

2 participants