Exemple #1
0
 /// <summary>
 /// Merge another IndexCollection into this one
 /// </summary>
 /// <param name="Other"></param>
 /// <remarks></remarks>
 public void Merge(TraitTypeCollection Other)
 {
     // for each index in the other colection
     foreach (var OtherIndex in Other)
     {
         // need to generalize the ability of a trait provider to influence a merge of its trait, but for the moment just skip SimilarLines here
         if (OtherIndex.Key == "SimilarLines")
         {
         }
         else
         {
             // see if it exists in this one
             if (TraitTypes.TryGetValue(OtherIndex.Key, out var ThisIdx))
             {
                 // if it does, merge them
                 ThisIdx.Merge(OtherIndex.Value);
             }
             else
             {
                 // if it does not, then just add the index from the other to this one
                 TraitTypes.Add(OtherIndex.Key, OtherIndex.Value);
             }
         }
     }
 }
Exemple #2
0
    public void AddTraitsFromLine(TraitTypeCollection traits, ELRecord r)
    {
        traits.AddLine("Provider", r.ProviderName, r);
        traits.AddLine("Level", r.Level, r);

        if (r.MessageLoadExeption is not null)
        {
            traits.AddLine("EventLogReadingException", r.MessageLoadExeption.Message, r);
        }

        if (r.Message.Contains("App Domain:"))
        {
            var ellt = new EnterpriseLibraryLogText(r.Message);

            // for short message use inner exception or StackTraceTopFrame if available, preferring StackTraceTopFrame

            if (!string.IsNullOrWhiteSpace(ellt.InnerException))
            {
                r.ShortMessage = ellt.InnerException;
                traits.AddLine("Inner Exception", ellt.InnerException, r);
            }

            if (!string.IsNullOrWhiteSpace(ellt.StackTraceTopFrame))
            {
                r.ShortMessage = ellt.StackTraceTopFrame;
                traits.AddLine("StackTraceTopFrame", ellt.StackTraceTopFrame, r);
            }

            if (!string.IsNullOrWhiteSpace(ellt.StackTraceBottomFrame))
            {
                traits.AddLine("StackTraceBottomFrame", ellt.StackTraceBottomFrame, r);
            }

            if (!string.IsNullOrWhiteSpace(ellt.RequestUrl))
            {
                traits.AddLine("RequestUrl", ellt.RequestUrl, r);
            }
        }

        TotalAgilityTraits.TotalAgilityTenantName(traits, r);

        CrashMessageTraits(traits, r);
    }
Exemple #3
0
        public static void TotalAgilityTenantName(TraitTypeCollection traits, ELRecord r)
        {
            // language=regex
            string msgregex = @"\w+_(?<dep>live|dev)";

            var ContentMatch = Regex.Match(r.Message, msgregex, RegexOptions.Singleline);

            if (ContentMatch.Success)
            {
                var dep        = ContentMatch.Groups["dep"].Value.Trim();
                var tenantcode = ContentMatch.Value;

                if (!string.IsNullOrWhiteSpace(dep))
                {
                    traits.AddLine("TotalAgility Deployment Type", dep, r);
                }
                if (!string.IsNullOrWhiteSpace(tenantcode))
                {
                    traits.AddLine("TotalAgility Tenant Code", tenantcode, r);
                }
            }

            // language=regex
            string formtwo = @"Tenant Code\s-\s(?<name>\w+)";

            var ContentMatch2 = Regex.Match(r.Message, formtwo, RegexOptions.Singleline | RegexOptions.IgnoreCase);

            if (ContentMatch2.Success)
            {
                var tenantcode = ContentMatch2.Groups["name"].Value.Trim();

                if (!string.IsNullOrWhiteSpace(tenantcode))
                {
                    traits.AddLine("TotalAgility Tenant Code", tenantcode, r);
                }
            }
        }
Exemple #4
0
    private static void CrashMessageTraits(TraitTypeCollection traits, ELRecord r)
    {
        if (r.Message.Contains("Faulting application name: "))
        {
            // language=regex
            string msgregex = @"Faulting application name: (?<name>.+?)\.exe(.+?)Exception code: (?<excode>0x[0-9A-Fa-f]{8})";

            var ContentMatch = Regex.Match(r.Message, msgregex, RegexOptions.Singleline);
            if (ContentMatch.Success)
            {
                var name   = ContentMatch.Groups["name"].Value.Trim();
                var excode = ContentMatch.Groups["excode"].Value.Trim();

                if (!string.IsNullOrWhiteSpace(name))
                {
                    traits.AddLine("Faulting Application", name, r);
                }
                if (!string.IsNullOrWhiteSpace(excode))
                {
                    traits.AddLine("Faulting Exception Code", excode, r);
                }
            }
        }
    }