[Solved] Truncate long lines

Hello,
I would like to be able to truncate long lines.
I found:
ruby { code => 'event["message"] = event.sprintf("_MESSAGE_SIZE_EXCEEDED_-_DROPPING_MESSAGE_") if event["message"].bytesize > 10240' }
I tried to alter it with:
event["message"].truncate(10240, omission: '... (continued)') if event["message"].bytesize > 10240
But there is no method truncate.
Any advice?
AM

Solved it by myself:
(m = event["message"][0..10200]; event["message"] = event.sprintf("#{m}... (truncated - message size exceeded)") ) if event["message"].bytesize > 10240

1 Like