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

Report failed cron jobs in swarm-cronjob log #194

Open
ieugen opened this issue Jun 3, 2022 · 1 comment
Open

Report failed cron jobs in swarm-cronjob log #194

ieugen opened this issue Jun 3, 2022 · 1 comment

Comments

@ieugen
Copy link

ieugen commented Jun 3, 2022

This is not a bug, it's a feature request.

I believe it would be very useful to have report sucess / failure of running tasks in swarm-cronjob logs.

Running the example with date, I can see some information in the logs but it's not clear which job failed and which succeeded.
I believe it can be done since swarm cronjobs has access to docker logs and can read information about those failed jobs.

infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:38:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:39:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:40:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:41:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:42:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:43:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:44:00 UTC INF Start job service=infra_cronjob_test status= tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:45:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:46:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:47:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:48:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:49:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:50:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:51:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:52:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:53:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:54:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:55:00 UTC INF Start job service=infra_cronjob_test status= tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:56:00 UTC INF Start job service=infra_cronjob_test status= tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:57:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:58:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 08:59:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 09:00:00 UTC INF Start job service=infra_cronjob_test status= tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 09:01:00 UTC INF Start job service=infra_cronjob_test status=paused tasks_active=0
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 09:02:00 UTC INF Start job service=infra_cronjob_test status= 

It would be great to have #170 but it looks more complex to implement.

@StephaneG31
Copy link

To illustrate that use case, in the products on which I work, we use swarm-cronjob, we collect the logs with a logging back (ELK or Loki) and we have the capacity to build alerts by checking logs from the stdout of all the container.
So have a line like :

infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 09:02:00 UTC INF Start job service=infra_cronjob_test container_id=owsz0yp6z375
infra_swarm_cronjob.1.l217ahvflt64@dev1    | Fri, 03 Jun 2022 09:02:00 UTC INF Stopped job service=infra_cronjob_test container_id=owsz0yp6z375 task_state=Failed

So we can resume the work to do by:

  • add the container id on each line (start or stop)
  • add a Stop line for each finished job with the Swarm Task State

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants