Only 1 line is tailed from the docker logs command, so when there are multiple cameras (2 in my case), there's a good chance that over a shorter timeout interval (including the default of 20s) that a camera will be shown as offline when it is actively logging, because the line that was tailed over that interval never happened to be a certain camera
https://github.com/parkpow/deep-license-plate-recognition/blob/master/stream/stream_monitor.py#L78
IMO it would be great if this monitor was part of the Stream image itself and did not rely on having to parse docker logs.
2022-08-23 15:04:38,235 DEBUG root Thread-1 : log_line: ['INFO', 'egress-north', '2022-08-23T15:04:33+00']
2022-08-23 15:04:38,235 DEBUG root Thread-1 : No new logs detected
127.0.0.1 - - [23/Aug/2022 15:04:38] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:38,241 DEBUG root Thread-2 : state:
2022-08-23 15:04:38,241 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 34, 40497), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:38,241 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:34.040497] and [2022-08-23 15:04:18.241586]
2022-08-23 15:04:38,241 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:18.241586]
2022-08-23 15:04:38,241 DEBUG root Thread-2 : response
2022-08-23 15:04:38,241 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'running'}}}
127.0.0.1 - - [23/Aug/2022 15:04:39] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:39,286 DEBUG root Thread-2 : state:
2022-08-23 15:04:39,286 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 34, 40497), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:39,286 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:34.040497] and [2022-08-23 15:04:19.286954]
2022-08-23 15:04:39,287 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:19.286954]
2022-08-23 15:04:39,287 DEBUG root Thread-2 : response
2022-08-23 15:04:39,287 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'running'}}}
2022-08-23 15:04:40,237 DEBUG root Thread-1 : Captures: 10
2022-08-23 15:04:40,320 DEBUG root Thread-1 : docker_log: INFO:egress-north:2022-08-23T15:04:38+00:00: Health Score: 70%
2022-08-23 15:04:40,320 DEBUG root Thread-1 : log_line: ['INFO', 'egress-north', '2022-08-23T15:04:38+00']
127.0.0.1 - - [23/Aug/2022 15:04:40] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:40,340 DEBUG root Thread-2 : state:
2022-08-23 15:04:40,340 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 40, 320456), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:40,340 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:40.320456] and [2022-08-23 15:04:20.340253]
2022-08-23 15:04:40,340 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:20.340253]
2022-08-23 15:04:40,340 DEBUG root Thread-2 : response
2022-08-23 15:04:40,340 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'running'}}}
127.0.0.1 - - [23/Aug/2022 15:04:41] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:41,385 DEBUG root Thread-2 : state:
2022-08-23 15:04:41,385 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 40, 320456), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:41,386 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:40.320456] and [2022-08-23 15:04:21.386020]
2022-08-23 15:04:41,386 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:21.386020]
2022-08-23 15:04:41,386 DEBUG root Thread-2 : response
2022-08-23 15:04:41,386 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'running'}}}
2022-08-23 15:04:42,321 DEBUG root Thread-1 : Captures: 11
2022-08-23 15:04:42,408 DEBUG root Thread-1 : docker_log: INFO:egress-north:2022-08-23T15:04:38+00:00: Health Score: 70%
2022-08-23 15:04:42,408 DEBUG root Thread-1 : log_line: ['INFO', 'egress-north', '2022-08-23T15:04:38+00']
2022-08-23 15:04:42,408 DEBUG root Thread-1 : No new logs detected
127.0.0.1 - - [23/Aug/2022 15:04:42] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:42,437 DEBUG root Thread-2 : state:
2022-08-23 15:04:42,438 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 40, 320456), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:42,438 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:40.320456] and [2022-08-23 15:04:22.438102]
2022-08-23 15:04:42,438 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:22.438102]
2022-08-23 15:04:42,438 DEBUG root Thread-2 : response
2022-08-23 15:04:42,438 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'running'}}}
127.0.0.1 - - [23/Aug/2022 15:04:43] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:43,566 DEBUG root Thread-2 : state:
2022-08-23 15:04:43,567 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 40, 320456), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:43,567 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:40.320456] and [2022-08-23 15:04:23.567227]
2022-08-23 15:04:43,567 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:23.567227]
2022-08-23 15:04:43,567 DEBUG root Thread-2 : response
2022-08-23 15:04:43,567 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'offline'}}}
2022-08-23 15:04:44,410 DEBUG root Thread-1 : Captures: 11
2022-08-23 15:04:44,564 DEBUG root Thread-1 : docker_log: INFO:egress-north:2022-08-23T15:04:43+00:00: Health Score: 70%
2022-08-23 15:04:44,565 DEBUG root Thread-1 : log_line: ['INFO', 'egress-north', '2022-08-23T15:04:43+00']
127.0.0.1 - - [23/Aug/2022 15:04:44] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:44,619 DEBUG root Thread-2 : state:
2022-08-23 15:04:44,619 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 44, 565161), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:44,619 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:44.565161] and [2022-08-23 15:04:24.619875]
2022-08-23 15:04:44,619 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:24.619875]
2022-08-23 15:04:44,619 DEBUG root Thread-2 : response
2022-08-23 15:04:44,620 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'offline'}}}
127.0.0.1 - - [23/Aug/2022 15:04:45] "GET / HTTP/1.1" 200 -
2022-08-23 15:04:45,701 DEBUG root Thread-2 : state:
2022-08-23 15:04:45,701 DEBUG root Thread-2 : {'container_active': False, 'last_log_times': {'egress-north': datetime.datetime(2022, 8, 23, 15, 4, 44, 565161), 'ingress-north': datetime.datetime(2022, 8, 23, 15, 4, 23, 282175)}, 'container_running': True}
2022-08-23 15:04:45,701 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:44.565161] and [2022-08-23 15:04:25.701526]
2022-08-23 15:04:45,701 DEBUG root Thread-2 : Comparing times: [2022-08-23 15:04:23.282175] and [2022-08-23 15:04:25.701526]
2022-08-23 15:04:45,701 DEBUG root Thread-2 : response
2022-08-23 15:04:45,701 DEBUG root Thread-2 : {'active': True, 'cameras': {'egress-north': {'status': 'running'}, 'ingress-north': {'status': 'offline'}}}
2022-08-23 15:04:46,565 DEBUG root Thread-1 : Captures: 12
2022-08-23 15:04:46,674 DEBUG root Thread-1 : docker_log: INFO:egress-north:2022-08-23T15:04:43+00:00: Health Score: 70%