Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Mar 17, 2024
1 parent c1a2427 commit 97744ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.ElasticCommonSchema</RepositoryUrl>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageIcon>AnalogyECS128x128.png</PackageIcon>
<Version>6.0.1</Version>
<Version>6.0.2</Version>
<Company>Analogy.LogViewer</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
Expand Down
52 changes: 26 additions & 26 deletions Analogy.LogViewer.ElasticCommonSchema/Parsers/EcsDocumentUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,36 @@ string GetMessage(EcsDocument ecsDocument)

try
{
var entry = EcsDocument.Deserialize(line);
var entry = EcsDocument.Deserialize(line.Trim());
AnalogyLogMessage message = new()
{
Date = entry.Timestamp?.DateTime ?? DateTime.MinValue,
Level = AnalogyLogMessage.ParseLogLevelFromString(entry.Log.Level),
RawText = line,
RawTextType = AnalogyRowTextType.JSON,
Text = GetMessage(entry),
MachineName = entry.Host?.Hostname ?? "",
ProcessId = (int)(entry.Process?.Pid ?? 0),
ThreadId = (int)(entry.Process?.ThreadId ?? 0),
LineNumber = (int)(entry.Log?.OriginFileLine ?? 0),
MethodName = entry.Log?.OriginFunction ?? "",
FileName = entry.Log?.OriginFileName ?? "",
Module = entry.Process?.Name ?? string.Empty,
Source = entry.Log?.Logger ?? string.Empty,
User = entry.User?.Name ?? "",
};
{
Date = entry.Timestamp?.DateTime ?? DateTime.MinValue,
Level = AnalogyLogMessage.ParseLogLevelFromString(entry.Log?.Level ?? "Unknown"),
RawText = line,
RawTextType = AnalogyRowTextType.JSON,
Text = GetMessage(entry),
MachineName = entry.Host?.Hostname ?? "",
ProcessId = (int)(entry.Process?.Pid ?? 0),
ThreadId = (int)(entry.Process?.ThreadId ?? 0),
LineNumber = (int)(entry.Log?.OriginFileLine ?? 0),
MethodName = entry.Log?.OriginFunction ?? "",
FileName = entry.Log?.OriginFileName ?? "",
Module = entry.Process?.Name ?? string.Empty,
Source = entry.Log?.Logger ?? string.Empty,
User = entry.User?.Name ?? "",
};
if (entry.Error?.Message is not null)
{
message.AddOrReplaceAdditionalProperty("Error", entry.Error.Message);
}
{
message.AddOrReplaceAdditionalProperty("Error", entry.Error.Message);
}
if (entry.Error?.StackTrace is not null)
{
message.AddOrReplaceAdditionalProperty("StackTrace", entry.Error.StackTrace);
}
{
message.AddOrReplaceAdditionalProperty("StackTrace", entry.Error.StackTrace);
}
if (entry.Log?.Logger is not null)
{
message.AddOrReplaceAdditionalProperty("Logger", entry.Log.Logger);
}
{
message.AddOrReplaceAdditionalProperty("Logger", entry.Log?.Logger);
}

//if (entry.Labels is not null)
//{
Expand Down

0 comments on commit 97744ba

Please sign in to comment.