1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 21:48:12 -05:00

Fix logging filter for IpRateLimitMiddleware

This commit is contained in:
Kyle Spearrin 2017-04-26 13:33:39 -04:00
parent 58339df56c
commit 91af4e12c7
2 changed files with 4 additions and 3 deletions

View File

@ -59,7 +59,7 @@ namespace Bit.Api.Middleware
if(blockedCount > 10) if(blockedCount > 10)
{ {
_blockIpService.BlockIpAsync(identity.ClientIp, false); _blockIpService.BlockIpAsync(identity.ClientIp, false);
_logger.LogDebug("Blocked " + identity.ClientIp); _logger.LogInformation($"Blocked {identity.ClientIp}");
} }
else else
{ {

View File

@ -238,12 +238,13 @@ namespace Bit.Api
Func<LogEvent, bool> serilogFilter = (e) => Func<LogEvent, bool> serilogFilter = (e) =>
{ {
var context = e.Properties["SourceContext"].ToString(); var context = e.Properties["SourceContext"].ToString();
if(e.Exception != null && e.Exception.GetType() == typeof(SecurityTokenValidationException) || e.Exception.Message == "Bad security stamp.") if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
e.Exception.Message == "Bad security stamp."))
{ {
return false; return false;
} }
if(context == typeof(IpRateLimitMiddleware).FullName && e.Level == LogEventLevel.Information) if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
{ {
return true; return true;
} }