I need to modify a little the output of my *.log files.

So I wanted to ask if it possible to generate some identifier(based on
some random value)
then add it for each line that correspond to an error that appeared ??

the reason of this problem is that I use syslog to put it to file ,
and in this file errors from rails can get mixed with other messages,
so I need this identifier to extract it from other stuff