logspout
logspout copied to clipboard
Use log timestamps from docker logs.
The rationale for this PR is that not preserving original timestamps by logspout makes investigation of issues across multiple services hard.
Hi @localghost
This is an interesting idea. I would imagine that the timestamps would be close since logspout retrieves the logs fairly quickly. I guess you would like to preserve the timestamp returned by the docker API. I would consider this if you can make it optional/configurable. Maybe you can introduce a bool flag, and by default we would use time.Now()
@gbolo Thanks for review. I will try to apply necessary fixes in a few days.
Hi @localghost
I agree with @michaelshobbs. This shouldn't be too hard. Just make a test case that focuses on testing the function parseLogLine
@gbolo, I know, I just don't have time currently. I will update this pr in a few days. Thanks.
@gbolo @michaelshobbs I have added tests but the CI failed, however, the failure does not look to be connected to my changes - maybe caused by recent github problems.
something changed with the upstream golint repo. i've had to modify other projects to get around this. please fix this in logspout by changing this line:
https://github.com/gliderlabs/logspout/blob/89c2a08735ecf2cc87d1831ff545dc2a01a2d837/Makefile#L41
to
test -x $(GOPATH)/bin/golint || go get golang.org/x/lint/golint
@gbolo @michaelshobbs CI is green
It looks like you changed back it to time.Now() . I am searching for a way to getting miliseconds of the dates. Since they are all 0, observing exceptions is hard. Is there a way to do it in updated version?
I have the same problem as @yunusemrecatalcam. What is the workaround for seeing real timestamps with at least millisecond resolution?