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

Detect container rename #144

Closed
siavashs opened this Issue Nov 18, 2015 · 6 comments

Comments

Projects
None yet
5 participants
@siavashs

siavashs commented Nov 18, 2015

logspout does not detect the new container name after it is renamed:

compassionate_knuth:  web.1    | info: HTTP GET / url=/, connection=upgrade, host=boer.host.com, x-forwarded-proto=http, x-forwarded-for=10.10.10.10, x-forwarded-port=80, x-request-start=1447862791.577, accept-encoding=gzip, deflate, accept=*/*, user-agent=HTTPie/0.8.0, method=GET, httpVersion=1.1, originalUrl=/, , statusCode=404, responseTime=4

We are using dokku and noticed that stoping/starting logspout resolves this issue.

~# dokku logspout:stop
04e262444bb7ee254af13cd01d9a5e4e2f79c329eed35c35d2262b8aad2d040b
~# dokku logspout:start
logspout
logspout:  2015/11/18 16:07:12 loading and persisting routes in /mnt/routes 
logspout:  2015/11/18 16:07:12 logspout v2 serving http on :8000 
logspout:  2015/11/18 16:07:12 routing all to syslog://logs.papertrailapp.com:XXXX
...
boer.web.1:  web.1    | info: HTTP GET / url=/, connection=upgrade, host=boer.host.com, x-forwarded-proto=http, x-forwarded-for=10.10.10.10, x-forwarded-port=80, x-request-start=1447862841.258, accept-encoding=gzip, deflate, accept=*/*, user-agent=HTTPie/0.8.0, method=GET, httpVersion=1.1, originalUrl=/, , statusCode=404, responseTime=2

But it would be nice if logspout could automatically detect a container renaming.

@mhlz

This comment has been minimized.

Show comment
Hide comment
@mhlz

mhlz Nov 25, 2015

I'm also using dokku and encountered this issue. I tried looking into the logspout code, but I have no idea where to even start. I'd love for this to be fixed!

mhlz commented Nov 25, 2015

I'm also using dokku and encountered this issue. I tried looking into the logspout code, but I have no idea where to even start. I'd love for this to be fixed!

@michaelshobbs

This comment has been minimized.

Show comment
Hide comment
@michaelshobbs

michaelshobbs Apr 13, 2016

Member

@progrium any thoughts here? I'm running into this too since I've started using logspout in prod. I'm happy to have a go at making this work but not sure where to start.

Additionally, I could modify dokku-logspout to restart on post-deploy, but does that mean logs would be dropped or does logspout maintain some sort of state as to ship missed logs while it was not running? 😄

Member

michaelshobbs commented Apr 13, 2016

@progrium any thoughts here? I'm running into this too since I've started using logspout in prod. I'm happy to have a go at making this work but not sure where to start.

Additionally, I could modify dokku-logspout to restart on post-deploy, but does that mean logs would be dropped or does logspout maintain some sort of state as to ship missed logs while it was not running? 😄

@progrium

This comment has been minimized.

Show comment
Hide comment
@progrium

progrium Apr 14, 2016

Contributor

Also came up in registrator. Both were made before you could rename. Can you see if the Docker event stream publishes an event when renaming? Otherwise this is going to get ugly.

Contributor

progrium commented Apr 14, 2016

Also came up in registrator. Both were made before you could rename. Can you see if the Docker event stream publishes an event when renaming? Otherwise this is going to get ugly.

@michaelshobbs

This comment has been minimized.

Show comment
Hide comment
@michaelshobbs

michaelshobbs Apr 14, 2016

Member

Turns out, yes.

Executing this command:

docker rename logspout logspout.old

Yields this single event:

{
  "Action": "rename",
  "Actor": {
    "Attributes": {
      "image": "gliderlabs/logspout:v3",
      "name": "logspout.old"
    },
    "ID": "db8499bc26911518ce5b418f4ad62269dee0fbd42d91fc7180cb1d62873a2b39"
  },
  "Type": "container",
  "from": "gliderlabs/logspout:v3",
  "id": "db8499bc26911518ce5b418f4ad62269dee0fbd42d91fc7180cb1d62873a2b39",
  "status": "rename",
  "time": 1460657124,
  "timeNano": 1460657124109265751
}
Member

michaelshobbs commented Apr 14, 2016

Turns out, yes.

Executing this command:

docker rename logspout logspout.old

Yields this single event:

{
  "Action": "rename",
  "Actor": {
    "Attributes": {
      "image": "gliderlabs/logspout:v3",
      "name": "logspout.old"
    },
    "ID": "db8499bc26911518ce5b418f4ad62269dee0fbd42d91fc7180cb1d62873a2b39"
  },
  "Type": "container",
  "from": "gliderlabs/logspout:v3",
  "id": "db8499bc26911518ce5b418f4ad62269dee0fbd42d91fc7180cb1d62873a2b39",
  "status": "rename",
  "time": 1460657124,
  "timeNano": 1460657124109265751
}

michaelshobbs added a commit to michaelshobbs/logspout that referenced this issue Apr 19, 2016

@mattatcha mattatcha closed this in #180 Apr 21, 2016

mattatcha added a commit that referenced this issue Apr 21, 2016

update container name if we get a rename event. closes #144 (#180)
* update container name if we get a rename event. closes #144
* revert to using event.ID
@iloveitaly

This comment has been minimized.

Show comment
Hide comment
@iloveitaly

iloveitaly May 5, 2016

@michaelshobbs awesome work implementing this fix! Could we cut a new release with this update?

iloveitaly commented May 5, 2016

@michaelshobbs awesome work implementing this fix! Could we cut a new release with this update?

@michaelshobbs

This comment has been minimized.

Show comment
Hide comment
@michaelshobbs

michaelshobbs May 5, 2016

Member

@josegonzalez is working on getting the release process documented and will cut one soon I believe

Member

michaelshobbs commented May 5, 2016

@josegonzalez is working on getting the release process documented and will cut one soon I believe

@mattatcha mattatcha referenced this issue May 23, 2016

Merged

v3.1 #192

dmilanp pushed a commit to duedil-ltd/logspout that referenced this issue Jul 12, 2016

Diego Milan
Squash commits from upstream changes.
The following commits are included from gliderlabs/master:

commit a415f5d
Merge: d56f003 324db6e
Author: Jose Diaz-Gonzalez <josegonzalez@users.noreply.github.com>
Date:   Fri Jul 1 12:14:40 2016 -0400

    Merge pull request #203 from udacity/master

    ignore containers with unsupported log drivers

commit 324db6e
Author: Paul M Bauer <paul@bauer.codes>
Date:   Fri Jul 1 08:22:56 2016 -0700

    ignore containers with unsupported log drivers

    trying to hit /logs for a container that does not support that endpoint
    results in the following error in that container's stdout

    "Error running logs job: configured logging reader does not support
    reading"

commit d56f003
Merge: 685c7bc 00147aa
Author: Jose Diaz-Gonzalez <josegonzalez@users.noreply.github.com>
Date:   Thu Jun 30 18:13:11 2016 -0400

    Merge pull request #171 from selimekizoglu/exclude-by-label

    Exclude containers by label.

commit 00147aa
Author: Selim Ekizoglu <selimeki@gmail.com>
Date:   Fri Jul 1 00:31:01 2016 +0300

    Ignore empty EXCLUDE_LABEL values

commit e92c2a0
Author: Selim Ekizoglu <selimeki@gmail.com>
Date:   Fri Jul 1 00:00:16 2016 +0300

    Fixed documentation

commit 079e8ae
Author: Selim Ekizoglu <selimeki@gmail.com>
Date:   Thu Jun 30 23:33:44 2016 +0300

    Renamed environment variable defining the label

commit 685c7bc
Merge: 5cad24a ff57c7d
Author: Jose Diaz-Gonzalez <josegonzalez@users.noreply.github.com>
Date:   Thu Jun 30 12:06:54 2016 -0400

    Merge pull request #200 from digitalkaoz/master

    Make Build Script Extentable

commit 7ed5fb4
Author: d-sekizoglu <d-sekizoglu@ziraatteknoloji.com>
Date:   Thu Jun 30 11:56:06 2016 +0300

    Documentation added

commit 5cad24a
Merge: 97c8c67 3ffcd8e
Author: Jose Diaz-Gonzalez <josegonzalez@users.noreply.github.com>
Date:   Wed Jun 29 16:30:02 2016 -0400

    Merge pull request #199 from iron-io/module-help

    Some instructions and helper scripts for working on custom modules.

commit 97c8c67
Merge: a923387 13d1129
Author: Jose Diaz-Gonzalez <josegonzalez@users.noreply.github.com>
Date:   Mon Jun 13 15:43:10 2016 -0400

    Merge pull request #191 from goodeggs/reconnect-logs

    reconnect log stream unless container is dead

commit 13d1129
Author: Bob Zoller <bob@zoller.us>
Date:   Wed Jun 8 12:07:34 2016 -0700

    avoid duplicate pumps with mutex lock

commit ff57c7d
Author: Robert Schönthal <caziel@gmx.net>
Date:   Mon Jun 6 23:01:51 2016 +0200

    Update Dockerfile

commit 3ffcd8e
Author: Travis Reeder <treeder@gmail.com>
Date:   Tue May 31 20:04:53 2016 -0700

    Some help for working on custom modules.

commit a923387
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Thu May 26 15:41:51 2016 -0500

    Fix for #193

commit 38fa4b7
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Mon May 23 16:38:58 2016 -0500

    bump

commit 19fa188
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Mon May 23 16:26:22 2016 -0500

    fixed version and date...

commit 72dada2
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Mon May 23 16:24:53 2016 -0500

    release prep

commit a86151b
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Mon May 23 16:21:24 2016 -0500

    Update chnagelog

commit 118f322
Author: Bob Zoller <bob@zoller.us>
Date:   Thu May 19 13:22:11 2016 -0700

    reconnect log stream unless container is dead

commit 23d3c9f
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Thu May 19 11:34:37 2016 -0500

    Quick fix for #185

commit 231ac0e
Author: Dylan Meissner <dylanmei@gmail.com>
Date:   Tue May 17 13:41:02 2016 -0700

    Add logspout-kafka module to README (#77)

commit 457941d
Author: Tony Nuzzi <nuzzis@sbcglobal.net>
Date:   Tue May 17 15:37:58 2016 -0500

    Add support text and command to stream logs to Loggly (#186)

commit 0175188
Author: R. Toma <rtoma@bol.com>
Date:   Tue May 17 22:35:07 2016 +0200

    added link to the logspout-redis-logstash module (#172)

    Change-Id: I69df9d76f472e84116a8e1b5b9e0c3cb255fe663

commit 8e54dea
Author: R. Toma <rtoma@bol.com>
Date:   Tue May 17 22:22:26 2016 +0200

    Now using Alpine Linux 3.3 and GO 1.5.3, removed the "edge" package repo for building the official Docker image (#174)

    Change-Id: I62a7960748906c1f9f7609dfc849f5ce0ce436fb

commit 1bfbc27
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Tue May 17 15:07:47 2016 -0500

    Fixes issue #183

commit b6acebc
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Thu May 12 23:20:35 2016 -0500

    cleaned up setup method

commit 67eaa00
Author: Matt Aitchison <Matt@lanciv.com>
Date:   Wed May 11 18:45:21 2016 -0500

    fix RouteManager.Name()

commit 90302f0
Author: Michael Hobbs <michaelshobbs@users.noreply.github.com>
Date:   Wed Apr 20 19:46:57 2016 -0700

    update container name if we get a rename event. closes #144 (#180)

    * update container name if we get a rename event. closes #144
    * revert to using event.ID

commit 113e3b7
Author: Selim Ekizoglu <sekizoglu@thoughtworks.com>
Date:   Thu Mar 24 17:57:49 2016 +0200

    Exclude containers by label.

    Closes #159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment