Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NLog SequenceId to ECS documents #392

Closed
wants to merge 1 commit into from
Closed

Conversation

Mpdreamz
Copy link
Member

No description provided.

@@ -539,6 +539,7 @@ private Event GetEvent(LogEventInfo logEventInfo)
? long.Parse(eventSeverity)
: GetSysLogSeverity(logEventInfo.Level),
Timezone = TimeZoneInfo.Local.StandardName,
Sequence = logEventInfo.SequenceID
Copy link
Contributor

@snakefoot snakefoot May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that NLog LogEventInfo.SequenceID is an integer. Thus if exceeding more than 2,147,483,647 LogEvents, then you will get bad behavior (imagine a service running for several days). See also: NLog/NLog#4159

Copy link
Member Author

@Mpdreamz Mpdreamz May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I noticed it was int 😢 I assumed NLog had a way of dealing with overflows.

But reading NLog/NLog#4159 SequenceId is actually lazy now and only increments if a layout is requesting it correct?

What happens with folks using SequenceId today, most likely overflowing? Meaning it effectively can't be used.

Whats your guidance @snakefoot keep it in so we can move along when NLog fixes this?
Or keep it out till then?

Copy link
Contributor

@snakefoot snakefoot May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking to obsolete NLog LogEventInfo.SequenceID and instead rely on LayoutRenderer like ${counter}.

I would probably implement EcsLayout SequenceId like ProcessId has been implemented (maybe unassigned by default). By using a Layout, then people can do whatever they want.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative just have a private long-field, and do Interlocked.Increment in the NLog EcsLayout for every LogEvent (Skip the overhead of NLog Layout)

But I don't know how Elastic Sequence are expected to be filled out when, when having single instance restarting frequently (starts counting from Sequence=0), or having multiple process-instances on the same machine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay in that case will close this! Thanks @snakefoot

@Mpdreamz Mpdreamz closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Include sequence id under event details
2 participants