Add a counter field to each message

This should be simple but I cannot find a solution - I want each message that is output to have a counter added that is incremented each time is new message is output