I want to look at last 1 hour of docker container log using docker logs --since
option. Which value I should provide for --since
parameter?

- 10,019
- 9
- 74
- 96

- 1,654
- 2
- 18
- 19
-
3Did you read the [docs](https://docs.docker.com/engine/reference/commandline/logs/)? – Oliver Charlesworth Jun 08 '17 at 18:28
-
Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306) – jww Jun 09 '17 at 10:20
-
@jww This question doesn't appear to be specific to Unix or Linux, unless Windows doesn't use dashes for command line options. – Andrew Grimm Feb 14 '19 at 00:15
-
@Andrew - Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. On-topic/off-topic has nothing to do with command line options. – jww Feb 14 '19 at 10:35
3 Answers
as the help says
--since string Show logs since timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes
I would do
docker logs mycontainer_or_id --since 60m
This syntax is correct according to my active container

- 30,758
- 6
- 57
- 59
Please refer to the Docker docs.
docker logs --since 1h
The --since option shows only the container logs generated after a given date. You can specify the date as an RFC 3339 date, a UNIX timestamp, or a Go duration string (e.g. 1m30s, 3h). Besides RFC3339 date format you may also use RFC3339Nano, 2006-01-02T15:04:05, 2006-01-02T15:04:05.999999999, 2006-01-02Z07:00, and 2006-01-02.

- 8,336
- 13
- 47
- 87
You may want logs from a specific date, but docker might not like your date's format.
In such cases, check whether the UNIX date
command parse it:
$ date -d "your date here"
Wed Oct 5 12:46:17 GMT 2022
If date
's output looks right, then you can use date -I
to produce a format that docker understands.
$ docker logs my_container --since "$(date -I -d "your date here")" | less -RX

- 29,306
- 13
- 121
- 110