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

Truncation not Working #313

Open
RyanGaudion opened this issue Jul 11, 2023 · 1 comment
Open

Truncation not Working #313

RyanGaudion opened this issue Jul 11, 2023 · 1 comment
Assignees
Labels

Comments

@RyanGaudion
Copy link

Bug description

I discovered an issue in my codebase where if I log a huge log (100kb) then it logs correctly to the file logger but suddenly all Syslogs stop forever more. Syslog stops working and reports not warnings or errors in the internal logger.

I tried to resolve this with the following however the bug continues. I even set truncateMessageTo to 16 however normal logs (before the bug occurs) still remain the same length (much longer than 4 bytes).

 <sl:enforcement>
   <sl:truncateMessageTo>1024</sl:truncateMessageTo>
 </sl:enforcement>

Expected behavior
I expect when truncateMessageTo is set to 16 that logs sent via syslog are going to be a max length of 16 characters

Actual behavior
None of the logs are truncated and everything remains the same size.

To reproduce
A list of steps to reproduce the behavior.

Additional context

  • NLog version: 5.2.2
  • NLog.Targets.Syslog version 7.0.0
  • NLog configuration used:
    <target xsi:type="Syslog" name="vSyslog">
      <sl:layout xsi:type="CompoundLayout">
        <layout type='SimpleLayout' text='@cee: ' />
        <layout type='${myLayout}' />
      </sl:layout>
      <sl:enforcement>
        <sl:truncateMessageTo>12</sl:truncateMessageTo>
      </sl:enforcement>
      <sl:messageCreation>
        <sl:rfc>Rfc5424</sl:rfc>
        <sl:rfc5424 hostname="${machinename}" appName="myApp" procId="${processid}" msgId="${threadid}">
        </sl:rfc5424>
      </sl:messageCreation>
      <sl:messageSend>
        <sl:protocol>TCP</sl:protocol>
        <sl:udp>
          <sl:server>server.com</sl:server>
          <sl:port>514</sl:port>
        </sl:udp>
        <sl:tcp>
          <sl:server>server.com</sl:server>
          <sl:port>514</sl:port>
        </sl:tcp>
      </sl:messageSend>
  </target>
@RyanGaudion
Copy link
Author

@luigiberrettini - this bug is still here. Any very long logs cause the nlog syslog target to stop working - no more logs are sent (while other nlog targets continue to work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants