From e0e9b4278f64e1d31373b0e459ce9f9c91f6bfdc Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Wed, 12 Jun 2024 12:59:54 +0100 Subject: [PATCH] Release: Improve documentation and number of logs cleaned. --- README.md | 8 ++++++++ events.go | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b9c6f4..33c9168 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,14 @@ You can check out the [example of combined deployment with RW and read-only hasu When enabled via `HASURA_EVENT_CLEANER=true` - proxy needs to have a direct access to the database to execute simple delete queries on schedule. You can specify number of days the logs should be kept for using `HASURA_EVENT_CLEANER_OLDER_THAN`, for example `HASURA_EVENT_CLEANER_OLDER_THAN=14` will keep 14 days of event execution logs. Ticker managing the cleaner routine will be executed every hour. +Following tables are being cleaned: +- `hdb_catalog.event_invocation_logs` +- `hdb_catalog.event_log` +- `hdb_catalog.hdb_action_log` +- `hdb_catalog.hdb_cron_event_invocation_logs` +- `hdb_catalog.hdb_scheduled_event_invocation_logs` + + ### Security #### Role-based rate limiting diff --git a/events.go b/events.go index 3d79fad..3d2fd53 100644 --- a/events.go +++ b/events.go @@ -45,12 +45,14 @@ func cleanEvents() { fmt.Sprintf("DELETE FROM hdb_catalog.event_invocation_logs WHERE created_at < now() - interval '%d days';", cfg.HasuraEventCleaner.ClearOlderThan), fmt.Sprintf("DELETE FROM hdb_catalog.event_log WHERE created_at < now() - interval '%d days';", cfg.HasuraEventCleaner.ClearOlderThan), fmt.Sprintf("DELETE FROM hdb_catalog.hdb_action_log WHERE created_at < NOW() - INTERVAL '%d days';", cfg.HasuraEventCleaner.ClearOlderThan), + fmt.Sprintf("DELETE FROM hdb_catalog.hdb_cron_event_invocation_logs WHERE created_at < NOW() - INTERVAL '%d days';", cfg.HasuraEventCleaner.ClearOlderThan), + fmt.Sprintf("DELETE FROM hdb_catalog.hdb_scheduled_event_invocation_logs WHERE created_at < NOW() - INTERVAL '%d days';", cfg.HasuraEventCleaner.ClearOlderThan), } for _, query := range delQueries { _, err := conn.Exec(context.Background(), query) if err != nil { - cfg.Logger.Error("Failed to execute query", map[string]interface{}{"query": query, "error": err}) + cfg.Logger.Debug("Failed to execute query", map[string]interface{}{"query": query, "error": err}) } } }