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); }
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); } } }
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); } } } }