Пример #1
0
        private void LogSearch(FeatureTraceCategory category, string message, int totalHits, long elapsedTime, string userId, string sessionId, int lcid, int crmLcid, string portalUrl, string portalVersion, string portalProductionOrTrialType)
        {
            try
            {
                InternalTrace.TraceEvent(
                    TraceEventType.Information,
                    (int)Feature.PortalSearch,
                    "Category:{0} Message:{1} TotalHits:{2} ElapsedTime:{3} UserID:{4} SessionID:{5} LCID:{6} CRMLCID:{7} PortalVersion:{8} PortalProductionOrTrialType:{9} PortalID={10}, PortalURL={11}, TenantID={12}, OrgID={13}, Geo={14}, PortalApp={15}, PortalType={16}",
                    category,
                    message,
                    totalHits,
                    elapsedTime,
                    userId,
                    sessionId,
                    lcid,
                    crmLcid,
                    portalVersion,
                    portalProductionOrTrialType,
                    PortalDetail.Instance.PortalId,
                    PortalDetail.Instance.AzurePortalUrl,
                    PortalDetail.Instance.TenantId,
                    PortalDetail.Instance.OrgId,
                    PortalDetail.Instance.Geo,
                    PortalDetail.Instance.PortalApp,
                    PortalDetail.Instance.PortalType);

                this.WriteEvent((int)Feature.PortalSearch, category, message, totalHits, elapsedTime, userId, sessionId, lcid, crmLcid, portalUrl, portalVersion, portalProductionOrTrialType);
            }
            catch (Exception ex)
            {
                ADXTrace.Instance.TraceError(TraceCategory.Exception, "LogSearch: received an unexpected exception. Message: " + ex.Message);
            }
        }
Пример #2
0
        public void LogFeatureUsage(FeatureTraceCategory category, HttpContextBase context, string action, string message, int itemCount, string entity, string cRED)
        {
            try
            {
                var  userId                = HashPii.GetHashedUserId(context);
                var  sessionId             = context != null && context.Session != null ? context.Session.SessionID : string.Empty;
                bool isPortalEntityAllowed = EntityNamePrivacy.IsPortalEntityAllowed(entity);

                cRED   = string.IsNullOrEmpty(cRED) ? "UnknownPortalAction" : cRED;
                entity = EntityNamePrivacy.GetEntityName(entity);
                action = cRED + (!isPortalEntityAllowed ? "__CustomEntityHashedName:" : "__") + entity;

                // message = EntityGUID

                this.LogFeatureUsage(
                    category,
                    userId,
                    sessionId,
                    action,
                    message,
                    itemCount,
                    entity,
                    this.Lcid,
                    this.CrmLcid,
                    this.PortalUrl,
                    this.PortalVersion,
                    this.ProductionOrTrial,
                    cRED,
                    this.ElapsedTime());
            }
            catch (Exception ex)
            {
                ADXTrace.Instance.TraceError(TraceCategory.Exception, "LogFeatureUsage: received unexpected exception. Message: " + ex.Message);
            }
        }
Пример #3
0
        private void LogAuthentication(FeatureTraceCategory category, string userId, string sessionId, string action, string entity, string portalUrl, string portalVersion, string portalProductionOrTrialType, string authenticationType, string elapsedTime)
        {
            try
            {
                InternalTrace.TraceEvent(
                    PortalSettings.Instance,
                    TraceEventType.Information,
                    (int)Feature.PortalAuthenticationEvent,
                    "Category:{0} UserID:{1} SessionID:{2} Action:{3} Entity:{4} PortalUrl:{5} PortalVersion:{6} PortalProductionOrTrialType:{7} PortalID={8}, PortalEvent={9}, TenantID={10}, OrgID={11}, Geo={12}, PortalApp={13}, PortalType={14}",
                    category,
                    userId,
                    sessionId,
                    action,
                    entity,
                    portalUrl,
                    portalVersion,
                    portalProductionOrTrialType,
                    PortalDetail.Instance.PortalId,
                    PortalEvents.Authentication,
                    PortalDetail.Instance.TenantId,
                    PortalDetail.Instance.OrgId,
                    PortalDetail.Instance.Geo,
                    PortalDetail.Instance.PortalApp,
                    PortalDetail.Instance.PortalType);

                this.WriteEvent((int)Feature.PortalAuthenticationEvent, category, userId, sessionId, action, entity, portalUrl, portalVersion, portalProductionOrTrialType, authenticationType, elapsedTime);
            }
            catch (Exception ex)
            {
                ADXTrace.Instance.TraceError(TraceCategory.Exception, "LogAuthentication: received unexpected exception. Message: " + ex.Message);
            }
        }
Пример #4
0
 public void LogAuthentication(FeatureTraceCategory category, HttpContext context, string action, string entity = "")
 {
     this.LogAuthentication(
         category,
         new HttpContextWrapper(context),
         action,
         entity);
 }
Пример #5
0
 public void LogFeatureUsage(FeatureTraceCategory category, HttpContext context, string action, int itemCount, EntityReference entity, string cRED)
 {
     this.LogFeatureUsage(
         category,
         new HttpContextWrapper(context),
         action,
         itemCount,
         entity,
         cRED);
 }
Пример #6
0
 public void LogSearch(FeatureTraceCategory category, int totalHits, long elapsedTime, string message)
 {
     this.LogSearch(category,
                    message,
                    totalHits,
                    elapsedTime,
                    this.UserId,
                    this.SessionId,
                    this.Lcid,
                    this.CrmLcid,
                    this.PortalUrl,
                    this.PortalVersion,
                    this.ProductionOrTrial);
 }
Пример #7
0
        public void LogFeatureUsage(FeatureTraceCategory category, HttpContextBase context, string action, int itemCount, EntityReference entity, string cRED)
        {
            var id = entity != null?entity.Id.ToString() : string.Empty;

            var logicalName = entity != null ? entity.LogicalName : string.Empty;

            this.LogFeatureUsage(
                category,
                context,
                action,
                id,
                itemCount,
                logicalName,
                cRED);
        }
Пример #8
0
        public void LogAuthentication(FeatureTraceCategory category, HttpContextBase context, string action, string entity = "", string authenticationType = "")
        {
            try
            {
                var userId    = HashPii.GetHashedUserId(context);
                var sessionId = context.Session.SessionID;

                this.LogAuthentication(
                    category,
                    userId,
                    sessionId,
                    action,
                    entity,
                    authenticationType);
            }
            catch (Exception ex)
            {
                ADXTrace.Instance.TraceError(TraceCategory.Exception, "LogAuthentication: received unexpected exception. Message: " + ex.Message);
            }
        }
Пример #9
0
 public void LogAuthentication(FeatureTraceCategory category, string userId, string sessionId, string action, string entity = "", string authenticationType = "")
 {
     try
     {
         this.LogAuthentication(
             category,
             userId,
             sessionId,
             action,
             entity,
             this.PortalUrl,
             this.PortalVersion,
             this.ProductionOrTrial,
             authenticationType,
             this.ElapsedTime());
     }
     catch (Exception ex)
     {
         ADXTrace.Instance.TraceError(TraceCategory.Exception, "LogAuthentication: received unexpected exception. Message: " + ex.Message);
     }
 }
Пример #10
0
        public void LogSessionInfo(FeatureTraceCategory category)
        {
            var userId        = string.Empty;
            var authenticated = false;
            var userAgent     = string.Empty;
            var ipAddress     = string.Empty;
            var context       = this.HttpContextBase;

            if (context != null)
            {
                try
                {
                    authenticated = context.User.Identity.IsAuthenticated;
                    userId        = HashPii.GetHashedUserId(context);
                    userAgent     = context.Request.UserAgent;
                    ipAddress     = HashPii.GetHashedIpAddress(context);
                }
                catch
                {
                }
            }

            this.LogSessionInfo(category,
                                userId,
                                authenticated
                                        ? "authenticated"
                                        : "nonauthenticated",
                                this.SessionId,
                                this.Lcid,
                                this.CrmLcid,
                                this.PortalUrl,
                                this.PortalVersion,
                                this.ProductionOrTrial,
                                userAgent,
                                ipAddress,
                                this.ElapsedTime(),
                                this.PersistentCookie);
        }
Пример #11
0
        private void LogFeatureUsage(FeatureTraceCategory category, string userId, string sessionId, string action, string message, int itemCount, string entity, int lcid, int crmLcid, string portalUrl, string portalVersion, string portalProductionOrTrialType, string cRED, string elapsedTime)
        {
            try
            {
                InternalTrace.TraceEvent(
                    PortalSettings.Instance,
                    TraceEventType.Information,
                    (int)Feature.PortalFeatureUsage,
                    "Category:{0} UserID:{1} SessionID:{2} Action:{3} Message:{4} ItemCount:{5} Entity:{6} Lcid:{7} CrmLcid:{8} PortalURL:{9} PortalVersion:{10} PortalProductionOrTrial:{11} PortalID={12}, PortalEvent={13}, TenantID={14}, OrgID={15}, Geo={16}, PortalApp={17}, PortalType={18}",
                    category,
                    userId,
                    sessionId,
                    action,
                    message,
                    itemCount,
                    entity,
                    lcid,
                    crmLcid,
                    portalUrl,
                    portalVersion,
                    portalProductionOrTrialType,
                    PortalDetail.Instance.PortalId,
                    PortalEvents.FeatureUsage,
                    PortalDetail.Instance.TenantId,
                    PortalDetail.Instance.OrgId,
                    PortalDetail.Instance.Geo,
                    PortalDetail.Instance.PortalApp,
                    PortalDetail.Instance.PortalType);

                this.WriteEvent((int)Feature.PortalFeatureUsage, category, userId, sessionId, action, message, itemCount, entity, lcid, crmLcid, portalUrl, portalVersion, portalProductionOrTrialType, cRED, elapsedTime);
            }
            catch (Exception ex)
            {
                ADXTrace.Instance.TraceError(TraceCategory.Exception, "LogFeatureUsage: received unexpected exception. Message: " + ex.Message);
            }
        }
Пример #12
0
        private void LogSessionInfo(FeatureTraceCategory category, string userId, string authenticated, string sessionId, int lcid, int crmLcid, string portalUrl, string portalVersion, string portalProductionOrTrialType, string userAgent, string ipAddress, string elapsedTime, string persistentCookie)
        {
            try
            {
                InternalTrace.TraceEvent(
                    PortalSettings.Instance,
                    TraceEventType.Information,
                    (int)Feature.PortalSession,
                    "Category:{0} UserID:{1} Authenticated:{2} SessionID:{3} Lcid:{4} CrmLcid:{5} PortalUrl:{6} PortalVersion:{7} PortalProductionOrTrial:{8} PortalID={9}, PortalEvent={10}, TenantID={11}, OrgID={12}, Geo={13}, PortalApp={14}, PortalType={15}, UserAgent={16}, IpAddress={17}, persistentCookie={18}",
                    category,
                    userId,
                    authenticated,
                    sessionId,
                    lcid,
                    crmLcid,
                    portalUrl,
                    portalVersion,
                    portalProductionOrTrialType,
                    PortalDetail.Instance.PortalId,
                    PortalEvents.FeatureUsage,
                    PortalDetail.Instance.TenantId,
                    PortalDetail.Instance.OrgId,
                    PortalDetail.Instance.Geo,
                    PortalDetail.Instance.PortalApp,
                    PortalDetail.Instance.PortalType,
                    userAgent,
                    ipAddress,
                    persistentCookie);

                this.WriteEvent((int)Feature.PortalSession, category, userId, authenticated, sessionId, lcid, crmLcid, portalUrl, portalVersion, portalProductionOrTrialType, userAgent, ipAddress, elapsedTime, persistentCookie);
            }
            catch (Exception ex)
            {
                ADXTrace.Instance.TraceError(TraceCategory.Exception, "LogSessionInfo: received unexpected exception. Message: " + ex.Message);
            }
        }