mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
More server logging
This commit is contained in:
parent
099afa3e2e
commit
f21b4569a2
@ -58,6 +58,7 @@ public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthentic
|
|||||||
var metricsKey = Request.Headers[_settings.MetricsKeyHeader].FirstOrDefault();
|
var metricsKey = Request.Headers[_settings.MetricsKeyHeader].FirstOrDefault();
|
||||||
// Never needed this, disabled for now
|
// Never needed this, disabled for now
|
||||||
//await LogRequest(metricsKey);
|
//await LogRequest(metricsKey);
|
||||||
|
var ip = Request.HttpContext.Connection.RemoteIpAddress?.ToString() ?? "";
|
||||||
if (metricsKey != default)
|
if (metricsKey != default)
|
||||||
{
|
{
|
||||||
if (await _tarLog.Contains(metricsKey))
|
if (await _tarLog.Contains(metricsKey))
|
||||||
@ -67,7 +68,8 @@ public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthentic
|
|||||||
Subject = metricsKey,
|
Subject = metricsKey,
|
||||||
Action = "tarlog",
|
Action = "tarlog",
|
||||||
MetricsKey = metricsKey,
|
MetricsKey = metricsKey,
|
||||||
UserAgent = Request.Headers.UserAgent
|
UserAgent = Request.Headers.UserAgent,
|
||||||
|
Ip = ip
|
||||||
});
|
});
|
||||||
await Task.Delay(TimeSpan.FromSeconds(20));
|
await Task.Delay(TimeSpan.FromSeconds(20));
|
||||||
throw new Exception("Error, lipsum timeout of the cross distant cloud.");
|
throw new Exception("Error, lipsum timeout of the cross distant cloud.");
|
||||||
|
@ -79,6 +79,7 @@ public class MetricsController : ControllerBase
|
|||||||
Subject = value,
|
Subject = value,
|
||||||
MetricsKey = metricsKey,
|
MetricsKey = metricsKey,
|
||||||
UserAgent = Request.Headers.UserAgent.FirstOrDefault() ?? "<unknown>",
|
UserAgent = Request.Headers.UserAgent.FirstOrDefault() ?? "<unknown>",
|
||||||
|
Ip = Request.HttpContext.Connection.RemoteIpAddress?.ToString() ?? ""
|
||||||
});
|
});
|
||||||
return new Result {Timestamp = date};
|
return new Result {Timestamp = date};
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,5 @@ public class Metric
|
|||||||
public string Subject { get; set; }
|
public string Subject { get; set; }
|
||||||
public string MetricsKey { get; set; }
|
public string MetricsKey { get; set; }
|
||||||
public string UserAgent { get; set; }
|
public string UserAgent { get; set; }
|
||||||
|
public string Ip { get; set; }
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user