feat: add new gotrue filters

This commit is contained in:
TzeYiing authored and Ziinc committed 2022-10-25 15:54:36 +08:00
1 parent 0e2f5a35dd
commit 19d6d8a145
1 file changed
+100
@@ -251,6 +251,19 @@ export const SQL_FILTER_TEMPLATES: any = {
},
auth_logs: {
..._SQL_FILTER_COMMON,
"severity.error": `REGEXP_CONTAINS(event_message, "level.{3}error|level.{3}fatal")`,
"severity.warning": `REGEXP_CONTAINS(event_message, "level.{3}warning")`,
"severity.info": `REGEXP_CONTAINS(event_message, "level.{3}info")`,
"status_code.server_error": `REGEXP_CONTAINS(event_message, "status.{3}5[0-9]{2}`,
"status_code.client_error": `REGEXP_CONTAINS(event_message, "status.{3}4[0-9]{2}")`,
"status_code.redirection": `REGEXP_CONTAINS(event_message, "status.{3}3[0-9]{2}")`,
"status_code.success": `REGEXP_CONTAINS(event_message, "status.{3}2[0-9]{2}")`,
"endpoints.admin": `REGEXP_CONTAINS(event_message, "path.{3}/admin")`,
"endpoints.signup": `REGEXP_CONTAINS(event_message, "path.{3}/signup|path.{3}/invite|path.{3}/verify")`,
"endpoints.authentication": `REGEXP_CONTAINS(event_message, "path.{3}/token|path.{3}/authorize|path.{3}/callback|path.{3}/otp|path.{3}/magiclink")`,
"endpoints.recover": `REGEXP_CONTAINS(event_message, "path.{3}/recover")`,
"endpoints.user": `REGEXP_CONTAINS(event_message, "path.{3}/user")`,
"endpoints.logout": `REGEXP_CONTAINS(event_message, "path.{3}/logout")`,
},
realtime_logs: {
..._SQL_FILTER_COMMON,
@@ -466,6 +479,93 @@ export const FILTER_OPTIONS: FilterTableSet = {
],
},
},
// auth logs
auth_logs: {
severity: {
label: 'Severity',
key: 'severity',
options: [
{
key: 'error',
label: 'Error',
description: 'Show all events that have error or fatal severity',
},
{
key: 'warning',
label: 'Warning',
description: 'Show all events that have warning severity',
},
{
key: 'info',
label: 'Info',
description: 'Show all events that have error severity',
},
],
},
status_code: {
label: 'Status Code',
key: 'status_code',
options: [
{
key: 'server_error',
label: 'Server Error',
description: 'Show all requests with 5XX status code',
},
{
key: 'client_error',
label: 'Client Error',
description: 'Show all requests with 4XX status code',
},
{
key: 'redirection',
label: 'Redirection',
description: 'Show all requests that have 3XX status code',
},
{
key: 'success',
label: 'Success',
description: 'Show all requests that have 2xx status code',
},
],
},
endpoints: {
label: 'Endpoints',
key: 'endpoints',
options: [
{
key: 'admin',
label: 'Admin',
description: 'Show all admin requests',
},
{
key: 'signup',
label: 'Sign up',
description: 'Show all signup and authorization requests',
},
{
key: 'recover',
label: "Password Recovery",
description: 'Show all password recovery requests',
},
{
key: 'authentication',
label: 'Authentication',
description: 'Show all authentication flow requests (login, otp, and Oauth2)',
},
{
key: 'user',
label: 'User',
description: 'Show all user data requests',
},
{
key: 'logout',
label: 'Logout',
description: 'Show all logout requests',
},
],
},
}
}
export const LOGS_TAILWIND_CLASSES = {