logspout icon indicating copy to clipboard operation
logspout copied to clipboard

Use log timestamps from docker logs.

Open localghost opened this issue 6 years ago • 9 comments

The rationale for this PR is that not preserving original timestamps by logspout makes investigation of issues across multiple services hard.

localghost avatar Jun 19 '18 20:06 localghost

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 avatar Sep 16 '18 15:09 gbolo

@gbolo Thanks for review. I will try to apply necessary fixes in a few days.

localghost avatar Sep 18 '18 08:09 localghost

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 avatar Oct 04 '18 14:10 gbolo

@gbolo, I know, I just don't have time currently. I will update this pr in a few days. Thanks.

localghost avatar Oct 04 '18 15:10 localghost

@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.

localghost avatar Oct 23 '18 08:10 localghost

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

michaelshobbs avatar Oct 23 '18 17:10 michaelshobbs

@gbolo @michaelshobbs CI is green

localghost avatar Oct 29 '18 09:10 localghost

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?
Screenshot_2019-10-22 Graylog - Search

yunusemrecatalcam avatar Oct 22 '19 08:10 yunusemrecatalcam

I have the same problem as @yunusemrecatalcam. What is the workaround for seeing real timestamps with at least millisecond resolution?

arseniybanayev avatar Jan 13 '20 19:01 arseniybanayev