-1

I'm configuring Syslog layout and I'm wondering if I can set a max string size for a parameter, so the output won't be to long. For example:

<parameter name="@tresc_requestu" layout="${event-context:item=tresc_requestu}" />

I would like the log output to be max 5 char long. Cheers.

mas
  • 1
  • 3

1 Answers1

0

NLog ver. 4.6.3 now supports truncate:

${event-context:item=tresc_requestu:truncate=5}

Older versions of NLog can use this very cryptic logic to truncate at 5 characters:

${trim-whitespace:inner=${event-context:item=tresc_requestu:padding=-5:fixedLength=true}}
Rolf Kristensen
  • 17,785
  • 1
  • 51
  • 70