Where are Docker logs stored by default?


wayner

Recommended Posts

I created a semi-manual docker for the Harmony-api using this file.  It works fine and when I click on the Docker from the unRAID UI I can see the log.  But I can't figure out what file the log is actually stored in.  Should it be in /var/log?  I don't see anything there. 

 

I am concerned that this log will grow to be very large as it is constantly polling the Logitech Harmony hubs on my LAN.  It seems that it will grow to at least a few hundred kB per day.  Is there any way to have the log flush every day or X number of bytes?

Link to comment

Ok - I think I have found this.  It is in the painfully named 

/var/lib/docker/containers/123456789074329872398471204271304723094872307234/ folder where the last parameter is the Container ID.  Is that correct?  And why use the Container ID rather than the docker name?  That makes it a pain to find the correct docker.

 

How do I limit the size of the log file?  Or is this best done from within the application?

Link to comment
Ok - I think I have found this.  It is in the painfully named 
/var/lib/docker/containers/123456789074329872398471204271304723094872307234/ folder where the last parameter is the Container ID.  Is that correct?  And why use the Container ID rather than the docker name?  That makes it a pain to find the correct docker.
 
How do I limit the size of the log file?  Or is this best done from within the application?
https://forums.lime-technology.com/topic/57181-real-docker-faq/?tab=comments#comment-564326

Sent from my SM-T560NU using Tapatalk

  • Upvote 1
Link to comment
  • 8 months later...
4 hours ago, jj_uk said:

Is it possible to add a share in the logs folder so i can copy the log file to windows PC ? 

I need to send a complete log file to a vendor (google) but I cant figure out how to copy the whole log to a windows PC.

 

Not sure about creating a share, but you should be able to use the Config File Editor plugin to open the log file in your browser and just copy/paste to a text file.

Link to comment
On 6/20/2018 at 11:30 PM, Squid said:

 


docker logs nameOfContainer > /boot/containerLog.txt

 

Thanks.

 

I run this command:

docker logs google-music-uploader > /boot/containerLog.txt

and the log scrolls up the screen, the file "containerLog.txt" is created but it's empty.

Edited by jj_uk
Link to comment
55 minutes ago, jj_uk said:

 

Thanks.

 

I run this command:


docker logs google-music-uploader > /boot/containerLog.txt

and the log scrolls up the screen, the file "containerLog.txt" is created but it's empty.

 

Sounds like the log data is emitted to standard error instead out standard out - then you will see the text scroll on the screen while a zero-size file is created.

 

Output emitted to standard error can be redirected with the following - the number 2 represents the stderr output stream.

cmd 2> file

Link to comment
31 minutes ago, jj_uk said:

Yes, this worked. Any ideas why its going to the error stream instead of the file stream? (unRAID version 6.5.3)

 

 

Docker captures both stdout and stderr output.

 

https://docs.docker.com/config/containers/logging/

 

For information about redirection, see the following link:

https://askubuntu.com/questions/625224/how-to-redirect-stderr-to-a-file

 

But > redirects stdout.

And 2> redirects stderr.

And &> redirects both.

Or you can do: cmd > outfile 2>&1

 

Link to comment
  • 2 years later...
  • 1 year later...

I have a slightly different but related question.

 

When I upgrade a docker app, there is a pop up with details about the upgrade. After the upgrade completes and I close that window and later find out that the upgrade failed, how do I know what the previous version of the docker image was? It's always set to xxx:latest in the template so there's no way of knowing after the operation completes what it was before. Is this information/log saved anywhere?

 

When filing an issue/ticket against the app, I'd like to know what the source and destination versions where that caused the failure.

 

Link to comment
2 hours ago, frakman1 said:

I have a slightly different but related question.

 

When I upgrade a docker app, there is a pop up with details about the upgrade. After the upgrade completes and I close that window and later find out that the upgrade failed, how do I know what the previous version of the docker image was? It's always set to xxx:latest in the template so there's no way of knowing after the operation completes what it was before. Is this information/log saved anywhere?

 

When filing an issue/ticket against the app, I'd like to know what the source and destination versions where that caused the failure.

 

Typically you can view past releases on the dockerhub page for that docker.

Link to comment
20 hours ago, wgstarks said:

Typically you can view past releases on the dockerhub page for that docker.

Unfortunately there is no way of knowing what the version I had running before the upgrade was. Was it the previous version? Was the it the one before that? etc.

I don't upgrade as soon as a new release is made so it could be anything in the last year.

 

Is there a log of the docker upgrade operations and associated output anywhere?

@Squid

It just seems wrong that if I didn't happen to take a screenshot of the docker upgrade popup then it's gone forever.

Edited by frakman1
Link to comment
10 hours ago, frakman1 said:

Is there a log of the docker upgrade operations and associated output anywhere?

 

no

 

I'm sure via applicable docker commands (inspect?) you could determine the digest of the container you were running and then compare that to the digest of the various tags to determine what :latest equated to, but it's a pain.

Link to comment
5 hours ago, Squid said:

you could determine the digest of the container you were running 

 

Thank you for the definitive answer and suggestion.

 

I don't understand where the previous container's digest would be. Doesn't the old container get blown away after an upgrade? The only "inspect" I can run is on the new container.

I also thought that an upgrade explicitly removed the orphan image that was the previous "latest" tagged image. I remember seeing that in the logs as the last step of the upgrade process.

So after an upgrade, both the old container and the old image are gone and all I have is the new image and the new container created from it. Am I missing something?

 

Maybe there's a misunderstanding. I'm not trying to figure out what version the current "latest" tag corresponds to. Yes, I can compare digests to published values.

I am trying to determine the version of the previous version of the app just before the failed upgrade. It was also tagged as "latest".

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.