Based on your sample data, this rex will pull what you’re looking for into a new field msg:
| rex field=_raw ":\s+(?<msg>\d+\s+\w+.+)"
You can then stats it into a table:
| stats count by msg
from User warren – Stack Overflow https://stackoverflow.com/questions/73039433/splunk-rex-command-to-search-exception-and-count-the-error-codes/73042485#73042485
via IFTTT