remove robots from db
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-- This migration is irreversible as we're deleting historical data
|
||||
-- If needed, you would need to restore from a backup
|
||||
|
||||
-- No-op down migration since we can't restore deleted tracking events
|
||||
SELECT 1;
|
||||
@@ -0,0 +1,29 @@
|
||||
-- Remove tracking events that match current ignored patterns
|
||||
|
||||
-- Remove visits to ignored paths
|
||||
DELETE FROM user_visits WHERE
|
||||
path = '/tracking' OR
|
||||
path = '/metrics' OR
|
||||
path LIKE '/css/%' OR
|
||||
path LIKE '/js/%' OR
|
||||
path = '/boxes/ws' OR
|
||||
path LIKE '%favicon%';
|
||||
|
||||
-- Remove visits from ignored user agents
|
||||
DELETE FROM user_visits WHERE
|
||||
user_agent LIKE '%Prometheus%' OR
|
||||
user_agent LIKE '%UptimeRobot%' OR
|
||||
user_agent LIKE 'NetworkingExtension%';
|
||||
|
||||
-- Optional: Clean up any other common bot/monitoring patterns that might exist
|
||||
DELETE FROM user_visits WHERE
|
||||
user_agent LIKE '%bot%' OR
|
||||
user_agent LIKE '%Bot%' OR
|
||||
user_agent LIKE '%crawler%' OR
|
||||
user_agent LIKE '%Crawler%' OR
|
||||
user_agent LIKE '%spider%' OR
|
||||
user_agent LIKE '%Spider%' OR
|
||||
user_agent LIKE '%monitor%' OR
|
||||
user_agent LIKE '%Monitor%' OR
|
||||
user_agent LIKE '%health%' OR
|
||||
user_agent LIKE '%Health%';
|
||||
@@ -101,7 +101,6 @@ func main() {
|
||||
}))
|
||||
}
|
||||
|
||||
// MY supper tracking
|
||||
e.Use(tracking.EchoWithConfig(tracking.TrackingConfig{
|
||||
IgnorePaths: []string{"/tracking", "/metrics", "/css/*", "/js/*", "/boxes/ws", "*favicon*"},
|
||||
IgnoreUserAgents: []string{"*Prometheus*", "*UptimeRobot*", "NetworkingExtension*"},
|
||||
|
||||
Reference in New Issue
Block a user