I have an application which is writing to syslog. The messages written to the syslog are for various buckets which need to be filtered out. Every message starts with a bucket number, so the messages are written as:
1: Message for bucket 1
14: Message for bucket 14
123: Message for bucket 123
I want to filter these messages based on the bucket number, which I suppose can be done with a regex. These buckets are numeric and can be in the range 1-999. The output for these buckets should go different files, one for each bucket. For the above example, it should be:
/var/log/myapp/1.log
/var/log/myapp/14.log
/var/log/myapp/123.log
Can someone help me with how this can be done with rsyslog?