1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-04 13:48:56 +02:00

chore: better logging of failed tokens (#10425)

When querying invalid tokens we might catch them for a while to reduce
database load. Being able to identify the token can help understanding
what's going on or the client using that token

Log looks like:
```
[INFO] /services/api-token-service.ts - Token default:development.3ef3... rate limited until: Tue Jul 29 2025 09:53:47 GMT+0000 (Coordinated Universal Time)
```
This commit is contained in:
Gastón Fournier 2025-07-29 12:48:41 +02:00 committed by GitHub
parent d48d1df095
commit 7479720f58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -171,9 +171,10 @@ export class ApiTokenService {
stopCacheTimer();
} else {
this.logger.info(
`Not allowed to query this token until: ${this.queryAfter.get(
secret,
)}`,
`Token ${secret.replace(
/^([^.]*)\.(.{8}).*$/,
'$1.$2...',
)} rate limited until: ${this.queryAfter.get(secret)}`,
);
}
}