Dynamic filename with $myhostname

This is the place for you, if you got rsyslog up and running but wonder how to make it do what you want.

Moderator: rgerhards

Google Ads


Dynamic filename with $myhostname

Postby Carl Cytryn » Wed Jun 28, 2017 12:46 am

hi All. I'm trying to include the rsyslog server's name in one set of logs which gets picked up by a third party app. the rsyslogd version is 7.4.10 (which is a bit old, I wan to upgrade but have to stick with this a bit longer).

I tried with the following config to embed the rsyslog server name into the filename:

Code: Select all
template (name="hostinfilename" type="string" string="/path/to/log/dir/xlog-%$myhostname%")
ruleset(name="xlog") {
    action(type="omfile" DynaFile="hostinfilename")
}


however this did not work. Any help is appreciated..

Thanks.
Carl Cytryn
New
 
Posts: 3
Joined: Wed Jun 28, 2017 12:29 am

Urgent Question?

  • Pulling out your Hair?
  • Wasting Time and Money?
  • Deadline Approaching?

Re: Dynamic filename with $myhostname

Postby Carl Cytryn » Wed Jun 28, 2017 1:37 am

I omitted two lines above. so make it complete

Code: Select all
module(load="imptcp")
template (name="hostinfilename" type="string" string="/path/to/log/dir/xlog-%$myhostname%")
ruleset(name="xlog") {
    action(type="omfile" DynaFile="hostinfilename")
}
input(type="imptcp" port="33333" ruleset="xlog");
Carl Cytryn
New
 
Posts: 3
Joined: Wed Jun 28, 2017 12:29 am

Re: Dynamic filename with $myhostname

Postby Carl Cytryn » Wed Jun 28, 2017 2:08 am

found the issue.. it was the ';' at the end of last line.
Carl Cytryn
New
 
Posts: 3
Joined: Wed Jun 28, 2017 12:29 am

Google Ads



Return to Configuration

Who is online

Users browsing this forum: No registered users and 2 guests

cron