示例#1
0
        // Token: 0x06002542 RID: 9538 RVA: 0x0008669C File Offset: 0x0008489C
        internal static void LogUserContextData(HttpContext httpContext, RequestDetailsLogger logger)
        {
            if (OwaServerLogger.instance == null || !OwaServerLogger.instance.Configuration.IsLoggingEnabled)
            {
                return;
            }
            IMailboxContext mailboxContext = UserContextManager.GetMailboxContext(httpContext, null, false);

            if (mailboxContext != null && mailboxContext.ExchangePrincipal != null)
            {
                if (mailboxContext.IsExplicitLogon && mailboxContext.LogonIdentity != null)
                {
                    logger.Set(OwaServerLogger.LoggerData.User, mailboxContext.LogonIdentity.PrimarySmtpAddress);
                }
                logger.Set(OwaServerLogger.LoggerData.PrimarySmtpAddress, mailboxContext.ExchangePrincipal.MailboxInfo.PrimarySmtpAddress);
                logger.Set(OwaServerLogger.LoggerData.MailboxGuid, mailboxContext.ExchangePrincipal.MailboxInfo.MailboxGuid);
                logger.Set(OwaServerLogger.LoggerData.RecipientType, mailboxContext.ExchangePrincipal.RecipientTypeDetails);
                Guid tenantGuid = mailboxContext.ExchangePrincipal.MailboxInfo.OrganizationId.GetTenantGuid();
                if (tenantGuid != Guid.Empty)
                {
                    logger.Set(OwaServerLogger.LoggerData.TenantGuid, tenantGuid);
                }
                string text = mailboxContext.Key.UserContextId.ToString(CultureInfo.InvariantCulture);
                logger.Set(OwaServerLogger.LoggerData.UserContext, text);
                if (!OwaServerLogger.TryAppendToIISLog(httpContext.Response, "&{0}={1}", new object[]
                {
                    UserContextCookie.UserContextCookiePrefix,
                    text
                }))
                {
                    ExTraceGlobals.RequestTracer.TraceWarning <Guid, string>((long)httpContext.GetHashCode(), "RequestId: {0}; Error appending UserContext '{1}' to IIS log.", logger.ActivityScope.ActivityId, text);
                }
                UserContext userContext = mailboxContext as UserContext;
                if (userContext != null && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.LogTenantInfo.Enabled)
                {
                    if (!string.IsNullOrEmpty(userContext.LogEventCommonData.TenantDomain))
                    {
                        OwaServerLogger.TryAppendToIISLog(httpContext.Response, "&{0}={1}", new object[]
                        {
                            "domain",
                            userContext.LogEventCommonData.TenantDomain
                        });
                        logger.Set(OwaServerLogger.LoggerData.Tenant, userContext.LogEventCommonData.TenantDomain);
                    }
                    if (userContext.IsBposUser && !string.IsNullOrEmpty(userContext.BposSkuCapability))
                    {
                        OwaServerLogger.TryAppendToIISLog(httpContext.Response, "&{0}={1}", new object[]
                        {
                            "bpossku",
                            userContext.BposSkuCapability
                        });
                        logger.Set(OwaServerLogger.LoggerData.ServicePlan, userContext.BposSkuCapability);
                    }
                    if (!string.IsNullOrEmpty(userContext.LogEventCommonData.Flights))
                    {
                        logger.Set(OwaServerLogger.LoggerData.Flights, userContext.LogEventCommonData.Flights);
                    }
                    if (!string.IsNullOrEmpty(userContext.LogEventCommonData.Features))
                    {
                        logger.Set(OwaServerLogger.LoggerData.Features, userContext.LogEventCommonData.Features);
                    }
                    if (userContext.UserCulture != null && !string.IsNullOrEmpty(userContext.UserCulture.Name))
                    {
                        logger.Set(OwaServerLogger.LoggerData.UserContextCulture, userContext.UserCulture.Name);
                    }
                }
            }
            UserContextStatistics userContextStatistics = UserContextManager.GetUserContextStatistics(httpContext);

            if (userContextStatistics != null)
            {
                logger.Set(OwaServerLogger.LoggerData.UserContextLatency, userContextStatistics.AcquireLatency);
                logger.Set(OwaServerLogger.LoggerData.UserContextCreated, userContextStatistics.Created ? 1 : 0);
            }
        }
示例#2
0
        // Token: 0x06002543 RID: 9539 RVA: 0x000869C8 File Offset: 0x00084BC8
        internal static void LogHttpContextData(HttpContext httpContext, RequestDetailsLogger logger)
        {
            if (OwaServerLogger.instance == null || !OwaServerLogger.instance.Configuration.IsLoggingEnabled)
            {
                return;
            }
            if (logger.Get(ExtensibleLoggerMetadata.EventId) == null)
            {
                if (!logger.ActivityScope.Statistics.Any <KeyValuePair <OperationKey, OperationStatistics> >())
                {
                    return;
                }
                OwaServerLogger.SetEventId(httpContext, logger);
            }
            logger.Set(OwaServerLogger.LoggerData.ContentLength, httpContext.Request.ContentLength);
            logger.Set(ServiceLatencyMetadata.HttpPipelineLatency, httpContext.Items[ServiceLatencyMetadata.HttpPipelineLatency]);
            NameValueCollection headers = httpContext.Request.Headers;
            string value = headers["X-OWA-ActionId"];

            if (!string.IsNullOrEmpty(value))
            {
                logger.Set(OwaServerLogger.LoggerData.ClientActionId, value);
            }
            string value2 = headers["X-OWA-ActionName"];

            if (!string.IsNullOrEmpty(value2))
            {
                logger.Set(OwaServerLogger.LoggerData.ClientActionName, value2);
            }
            string value3 = headers["X-EXT-ClientName"];

            if (!string.IsNullOrEmpty(value3))
            {
                logger.Set(OwaServerLogger.LoggerData.ExternalClientName, value3);
            }
            string value4 = headers["X-EXT-CorrelationId"];

            if (!string.IsNullOrEmpty(value4))
            {
                logger.Set(OwaServerLogger.LoggerData.ExternalCorrelationId, value4);
            }
            string sourceCafeServer = CafeHelper.GetSourceCafeServer(httpContext.Request);

            if (!string.IsNullOrEmpty(sourceCafeServer))
            {
                logger.Set(OwaServerLogger.LoggerData.FrontEndServer, sourceCafeServer);
            }
            string value5 = headers["X-OWA-OfflineRejectCode"];

            if (!string.IsNullOrEmpty(value5))
            {
                logger.Set(OwaServerLogger.LoggerData.OfflineRejectCode, value5);
            }
            string text = headers["logonLatency"];
            bool   flag = UserContextUtilities.IsDifferentMailbox(httpContext);

            if (!string.IsNullOrEmpty(text) || flag)
            {
                IMailboxContext mailboxContext = UserContextManager.GetMailboxContext(httpContext, null, false);
                if (!string.IsNullOrEmpty(text))
                {
                    logger.Set(OwaServerLogger.LoggerData.LogonLatencyName, text);
                    string userContext = string.Empty;
                    if (mailboxContext != null)
                    {
                        userContext = mailboxContext.Key.UserContextId.ToString(CultureInfo.InvariantCulture);
                    }
                    string[] keys = new string[]
                    {
                        "LGN.L"
                    };
                    string[] values = new string[]
                    {
                        text
                    };
                    Datapoint      datapoint = new Datapoint(DatapointConsumer.Analytics, "LogonLatency", DateTime.UtcNow.ToString("o"), keys, values);
                    ClientLogEvent logEvent  = new ClientLogEvent(datapoint, userContext);
                    OwaClientLogger.AppendToLog(logEvent);
                }
                if (flag && mailboxContext is SharedContext && httpContext.Items.Contains("CallContext"))
                {
                    CallContext callContext = httpContext.Items["CallContext"] as CallContext;
                    logger.Set(OwaServerLogger.LoggerData.User, callContext.GetEffectiveAccessingSmtpAddress());
                }
            }
            string value6 = httpContext.Items["BackEndAuthenticator"] as string;

            if (!string.IsNullOrEmpty(value6))
            {
                logger.Set(OwaServerLogger.LoggerData.BackendAuthenticator, value6);
            }
            object obj = httpContext.Items["TotalBERehydrationModuleLatency"];

            if (obj != null)
            {
                logger.Set(OwaServerLogger.LoggerData.RehydrationModuleLatency, obj);
            }
            string value7 = headers["X-OWA-Test-PassThruProxy"];

            if (!string.IsNullOrEmpty(value7))
            {
                logger.Set(OwaServerLogger.LoggerData.PassThroughProxy, value7);
            }
            string value8 = headers["X-SuiteServiceProxyOrigin"];

            if (!string.IsNullOrEmpty(value8))
            {
                logger.Set(OwaServerLogger.LoggerData.SuiteServiceProxyOrigin, value8);
            }
            HttpCookie httpCookie = httpContext.Request.Cookies["ClientId"];

            if (httpCookie != null)
            {
                logger.Set(OwaServerLogger.LoggerData.ClientId, httpCookie.Value);
            }
        }