Get Mesos task ID from Marathon

413 views
Skip to first unread message

Antonio Fernández Vara

unread,
May 18, 2015, 10:51:22 AM5/18/15
to marathon-...@googlegroups.com
Hi!

we are getting logs from docker to an InfluxDB server. We want to identify each app log with the correct machines where the app resides, but we are not able to. 

Are there any endpoint on the Marathon API that match both IDs?

Can we get that information from mesos API directly?

Thanks in advance.

Dario Rexin

unread,
May 26, 2015, 4:53:36 AM5/26/15
to Antonio Fernández Vara, marathon-...@googlegroups.com
Hi Antonio,

Marathon only uses the Mesos task ID, what other ID would you like to use? The Docker ID? If that’s the case, I have to tell you that Mesos does not send the Docker ID to Marathon, so there’s unfortunately no way to use it to match a task in Marathon.

Cheers,
Dario

--
You received this message because you are subscribed to the Google Groups "marathon-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marathon-framew...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Antonio Fernández Vara

unread,
May 26, 2015, 5:32:20 AM5/26/15
to Dario Rexin, marathon-...@googlegroups.com
Hi Dario,

Thanks for the answer, after some research I found a workaround for that issue. We were looking to obtain the logs from the docker instances for every marathon app. Since Marathon adds a EnvVar to the dockers we modified the heka source https://github.com/mozilla-services/heka/pull/1546 that allow us to send the MESOS_TASK_ID (the one that marathon sets) instead of the docker instance name.

This way we can query for an app using the marathon API, get all task_ids and query for the logs in InfluxDB with a simple select (select * from logs where ContainerName=task_id1 OR ContainerName = task_id2 ....)

Before that, we thought making a simple service that could read the envvar and container name to make that match, but was a really flaky solution, since we could make it simpler.

Thanks a lot.
Antonio
Reply all
Reply to author
Forward
0 new messages