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

[Feature] docker logs --head #13096

Closed
MrMMorris opened this issue May 8, 2015 · 7 comments

Comments

@MrMMorris
Copy link

commented May 8, 2015

We have --tail but not --head for whatever reason.

This is useful for something like mongoDB where there is a lot of valuable startup info when the container starts, but a LOT of repeated, less useful logs after. If startup fails and I can't look at the logs for a while, I have to risk filling up my screen with every log since startup and then scroll alllllll the way to the beginning to find what I need....

@thaJeztah

This comment has been minimized.

Copy link
Member

commented May 9, 2015

Sounds reasonable, given the use case you're describing. (Slightly) related PR; #12362

cc @LK4D4

@phemmer

This comment has been minimized.

Copy link
Contributor

commented May 9, 2015

what about using the head or less utilities? Do we really need to re-invent this within docker?

@MrMMorris

This comment has been minimized.

Copy link
Author

commented May 9, 2015

oh.... 😊 I guess head does the job too. I guess I just assumed it wouldn't work for some reason and that's why we had --tail

...

why do we have --tail?

@MrMMorris MrMMorris closed this May 9, 2015

@LK4D4

This comment has been minimized.

Copy link
Contributor

commented May 9, 2015

Because tail won't allow you to follow logs.

@bo0ts

This comment has been minimized.

Copy link

commented May 18, 2015

I think that would still be valuable for APIs. I have some useful output at the beginning of a container and extract it with docker-py. Currently I stream the logs to avoid reading the entire log to begin with, but this requires me to check that the container is actually stopped so I don't stream forever if the container didn't produce the expected output for whatever reason. --head would solve that nicely.

@schrieveslaach

This comment has been minimized.

Copy link

commented Jul 22, 2019

I'm using dockers REST API through the shiplift crate and in my use case I need to look into the first 1000 loglines. However, is this possible without the head option? Currently I have to wait for all log messages to be processed which is quite slow.

@schrieveslaach

This comment has been minimized.

Copy link

commented Jul 23, 2019

In aixigo/PREvant#12 it would improve the performance of the PREvant's REST API when Docker's REST API would support the equivalent of the following command.

docker logs [CONTAINER] --since [TIMESTAMP] --head [NUMBER]

Do you have any plans to support this? Is it possible to reopen this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.