mirror of
https://github.com/bitwarden/server.git
synced 2025-04-22 21:45:15 -05:00
format ban logs better
This commit is contained in:
parent
0e143a78e5
commit
4cbf3a4b5b
@ -60,11 +60,11 @@ namespace Bit.Core.Utilities
|
|||||||
if(blockedCount > 10)
|
if(blockedCount > 10)
|
||||||
{
|
{
|
||||||
_blockIpService.BlockIpAsync(identity.ClientIp, false);
|
_blockIpService.BlockIpAsync(identity.ClientIp, false);
|
||||||
_logger.LogInformation($"Banned {identity.ClientIp}. Info: {GetRequestInfo(httpContext)}");
|
_logger.LogInformation($"Banned {identity.ClientIp}. \nInfo: \n{GetRequestInfo(httpContext)}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"Request blocked {identity.ClientIp}. Info: {GetRequestInfo(httpContext)}");
|
_logger.LogInformation($"Request blocked {identity.ClientIp}. \nInfo: \n{GetRequestInfo(httpContext)}");
|
||||||
_memoryCache.Set(key, blockedCount,
|
_memoryCache.Set(key, blockedCount,
|
||||||
new MemoryCacheEntryOptions().SetSlidingExpiration(new TimeSpan(0, 5, 0)));
|
new MemoryCacheEntryOptions().SetSlidingExpiration(new TimeSpan(0, 5, 0)));
|
||||||
}
|
}
|
||||||
@ -80,12 +80,12 @@ namespace Bit.Core.Utilities
|
|||||||
var s = string.Empty;
|
var s = string.Empty;
|
||||||
foreach(var header in httpContext.Request.Headers)
|
foreach(var header in httpContext.Request.Headers)
|
||||||
{
|
{
|
||||||
s += $"H_{header.Key}: {header.Value} | ";
|
s += $"Header \"{header.Key}\": {header.Value} \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var query in httpContext.Request.Query)
|
foreach(var query in httpContext.Request.Query)
|
||||||
{
|
{
|
||||||
s += $"Q_{query.Key}: {query.Value} | ";
|
s += $"Query \"{query.Key}\": {query.Value} \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user