Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.