Moderator: rgerhards
hkspvt wrote:I don't believe so. What are you trying to accomplish? Perhaps we can come up with something to accomplish the same goal.
-HKS
#!/bin/sh
#template get from rsyslog.conf
template=$1
#file to write
log_file=/var/log/messages
host=`echo $template | cut -d'|' -f1`
host_ip=`echo $template | cut -d'|' -f2`
facility=`echo $template | cut -d'|' -f3`
priority=`echo $template | cut -d'|' -f4`
tag=`echo $template | cut -d'|' -f5`
timegenerated=`echo $template | cut -d'|' -f6`
timereported=`echo $template | cut -d'|' -f7`
progname=`echo $template | cut -d'|' -f8`
msg=`echo $template | cut -d'|' -f9`
timegenerated_unix=$(date --date="$timegenerated" +%s)
timereported_unix=$(date --date="$timereported" +%s)
#The new string of log
log=$host'|'$host_ip'|'$facility'|'$priority'|'$tag'|'$timegenerated_unix'|'$timereported_unix'|'$progname'|'$msg
#write in append to log_file, or if i want, i call the external application
`echo $log >> $log_file`
exit 0
$template mytemplate,"%HOSTNAME%|%fromhost-ip%|%syslogfacility-text%|%syslogpriority%|%syslogtag%|%timegenerated%|%timereported%|%programname%\|%msg%\n"*.info;mail.none;authpriv.none;cron.none ^/path_to_my_script/script.sh;mytemplateUsers browsing this forum: No registered users and 0 guests