Information: Forum is in read-only mode
For details and other support options see https://www.adiscon.com/news/support-forum-set-to-read-only-mode/

how to change template from 127.0.0.1 to the host IP address

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

Moderator: alorbach

Google Ads


how to change template from 127.0.0.1 to the host IP address

Postby rsyslogbob » Wed Mar 14, 2018 3:57 am

Hi there,

In rsyslog.conf I'd like to create a template which uses the IP address of my server rather than the hostname.

I don't want to hardcode my IP because that would be hard to maintain on thousands of unix servers eg:

$template Forwarder, "<%pri%> %timestamp% X.X.X.X %syslogtag% %msg%\n"

is there a variable like %fromhost-ip% that will do this? (I tried fromhost-ip but it only seems to resolve to 127.0.0.1).

(no, I can't resolve the hostname to an IP on the upstream syslog receiver).

eg, I get this:
Apr 28 17:06:20 bobserver.abc.com sshd[12545]: Received disconnect from 216.19.2.8: 11: Bye Bye [preauth]
or this:
Apr 28 17:06:20 127.0.0.1 sshd[12545]: Received disconnect from 216.19.2.8: 11: Bye Bye [preauth]

But I want this:

Apr 28 17:06:20 20.1.2.3 sshd[12545]: Received disconnect from 216.19.2.8: 11: Bye Bye [preauth]
rsyslogbob
New
 
Posts: 1
Joined: Wed Mar 14, 2018 3:47 am

Urgent Question?

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

Re: how to change template from 127.0.0.1 to the host IP add

Postby dlang » Wed Mar 14, 2018 8:22 am

you cannot change any of the standard properties (including %fromhost% and %fromhost-ip%, but you can set a new template to use that replaces the hostname field with whatever you want (a constant or a variable)
dlang
Frequent Poster
 
Posts: 1002
Joined: Mon Sep 15, 2008 7:44 am

Google Ads



Return to Configuration

Who is online

Users browsing this forum: No registered users and 0 guests

cron