protected void Page_Load(object sender, EventArgs e) { // Setup title CurrentMaster.Title.TitleText = GetString("ViewRequest.Title"); CurrentMaster.Title.TitleImage = GetImageUrl("Objects/__GLOBAL__/Object.png"); guid = QueryHelper.GetGuid("guid", Guid.Empty); if (guid != Guid.Empty) { // Find the root log RequestLog log = CMSFunctions.FindRequestLog(guid); if (log != null) { // Setup the logs RequestLogs logs = log.ParentLogs; plcLogs.Controls.Add(new LiteralControl("<div><strong> " + logs.RequestURL + "</strong> (" + logs.RequestTime.ToString("hh:MM:ss") + ")</div><br />")); logFiles.Log = logs.FilesLog; logCache.Log = logs.CacheLog; logOutput.Log = logs.OutputLog; logSec.Log = logs.SecurityLog; logMac.Log = logs.MacrosLog; logSQL.Log = logs.QueryLog; logState.Log = logs.ViewStateLog; logReq.Log = logs.RequestLog; logFarm.Log = logs.WebFarmLog; } } }
public override void OnActionExecuted(ActionExecutedContext context) { RequestLogs logs = new RequestLogs() { Id = SequenceID.GetSequenceID(), ApiName = context.HttpContext.Request.GetEncodedUrl(), IP = context.HttpContext.Connection.RemoteIpAddress.ToString(), Headers = JsonConvert.SerializeObject(context.HttpContext.Request.Headers), QueryString = context.HttpContext.Request.QueryString.Value, StatusCode = context.HttpContext.Response.StatusCode, Result = JsonConvert.SerializeObject(context.Result) }; string token = context.HttpContext.Request.Headers["Authorization"]; if (!string.IsNullOrEmpty(token)) { if (AuthRedis.GetUserByToken(token, out UserInfo userInfo)) { logs.UID = userInfo.id; } } DBRequestLogs _logs = new DBRequestLogs(); _logs.Create(logs); }
Router(RouteTable[] routeTables, int requestLogsSize, int timerPeriodMs) { this.routeTables = routeTables; rateLimitedEndpoints = routeTables.SelectMany(table => table.Where(ep => ep is RateLimitedEndpoint).Cast <RateLimitedEndpoint>()) .ToArray(); requestLogs = new RequestLogs(this, requestLogsSize); Metrics = new RouterMetrics(this); timer = new WaitableTimer("RouterTimer", TimeSpan.FromMilliseconds(timerPeriodMs), new [] { new WaitableTimer.Job("UpdateRateLimitBuckets", UpdateRateLimitBuckets), new WaitableTimer.Job("ProcessRequestLogs", ProcessRequestLogs) }); }
/// <summary> /// Adds the log to per-request cache. They will be flushed to DB at once, at the end of request. /// </summary> /// <param name="log">The log.</param> public void AddRequestLog(Log log) { RequestLogs.Add(log); }
public void Update(RequestLogs RequestLogs) => _logs.ReplaceOne(sub => sub.id == RequestLogs.id, RequestLogs);
public RequestLogs Create(RequestLogs idata) { _logs.InsertOne(idata); return(idata); }