How to limit lines of log before sending to destination

Hi there,

I have an alert that sends application error logs to Slack. Is there any way to just send a few lines of the log to Slack instead of the full log.

Thanks in advance!