0

I have to send data from rsyslog in a format like this Eg:

fac:kern HELLO pri:info HELLO May  5 14:06:31 nitish-VirtualBox kernel: Kernel logging (proc) stopped.

So i created a new conf file called "my.conf" in /etc/rsyslog.d/ and added the following lines in it

$template myFormat,"fac:%syslogfacility-text% HELLO pri:%syslogpriority-text% HELLO %timegenerated% %msg%\n" 
*.* /home/user/log.txt;myFormat

so that i can strip this log message in my java application to get facility name,priority name and rest of the message.Here string "HELLO" acts as a filter element.

i can create templates in rsyslog and send incoming syslog messages in this format to log.txt. But now i have to send log messages from sysklogd(not syslog-ng and not rsyslog) in the same format but sysklogd does not support templates.So is there a way to change the log message format in sysklogd

Rajendra_Prasad
  • 1,300
  • 4
  • 18
  • 36
Nitish P
  • 43
  • 9

1 Answers1

0

In a word, no. Your best bet is to get it out of sysklogd and over to a daemon which is capable of manipulating the template (even if it's by relaying to a second syslogd on the same system).

Troy Davis
  • 487
  • 5
  • 8
  • But i would not know the priority or the facility info which i need from the log message.Because i tried forwarding msgs from syslog.conf like *.* /home/nitish/nitish.log and i got message in this format Example: May 11 15:14:20 nitish-VirtualBox syslogd 1.5.0#6ubuntu1: restart. May 11 15:14:20 nitish-VirtualBox sudo: pam_unix(sudo:session): session closed for user root – Nitish P May 11 '13 at 09:47