Problem/Motivation
redirect_404 aggregates 404 requests in a single table with a single total counter. That's useful for users to see, but it's a problem for monitoring, as sooner or later, some URL's from bots or something will go over a static threshold, as we have no way to know which requests are from the last 24h.
Proposed resolution
Add a daily counter which resets every day by a cron job.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3100270-interdiff-2-4.txt | 2.84 KB | arpad.rozsa |
| #4 | 3100270-add_daily_count-4.patch | 12.97 KB | arpad.rozsa |
| #2 | 3100270-add_daily_count-2.patch | 12.52 KB | arpad.rozsa |
Comments
Comment #2
arpad.rozsa commentedComment #3
berdirCan't we just do date('d', $last_daily_reset) != date('d')?
We don't need a full diff, if the day doesn't match, we can reset.
Lets use \Drupal::requestTime()->getRequestTime() for that.
db_query() is deprecated, should use \Drupal::database()->query()
Lets simulate also that we don't delete it every time we call the function.
So insert/update a row with daily counts, call cron again, make sure it's still there.
db_insert() is deprected too. We should not update everything, but since we touch this line and the D9 patch will conflict, lets update this one too.
Comment #4
arpad.rozsa commentedUpdated the patch.
Comment #6
berdirDid some manual tests, seems to work nicely.