Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The messages that I'm sending to syslog have some tags like so:

"[date] [text here] tags:tag1,tag2,tag3 [more text here]"

I already have a rule that only saves lines that contain the text "tags:" to a specific file.

It would be great if that file only contained a substring of that message, in this case just the date and the tags part.

Can rsyslog do some processing/manipulation to a message prior to saving it?

Thanks in advance.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Yes, it can. The place to look for information is at the rsyslog documentation for property replacer. If the list of tags is always the same length, you can use substring. Otherwise you'll need to use a regexp, e.g.

%msg:R:.(tags:[\S]+).--end%

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.