On 05/10/2013 06:58 PM, David Lang wrote:
On Fri, 10 May 2013, Erik Steffl wrote:
On Ubuntu (uses upstart):
I would like to have a dynamically created data as part of rsyslog
(essentially host id that I don't know before the host is
created/started).
What is the best way to achieve this? I see that there is a way to
get environment variable in rsyslog config (using getenv) but since
rsyslog is started by init it has no env variables (i.e. the variables
in /etc/environment or /etc/profile.d/* are not set).
There is /etc/default/rsyslog but I would like to avoid changing
system files plus not sure how to make sure it's changed before the
system starts (it's a shell script so I guess I could add a line there
HOST_ID=$(getHostId))
thanks!
Currently, the only way to set a variable that rsyslog would use across
the board would be to modify the config file (or an included config
file) and then restart rsyslog.
But I'm not understanding what it is that you are trying to do.
Rsyslog doesn't have any internal variable for the system hostname, it
asks the OS.
It can extract data from logs and use it, but that is a per log message
thing, not something you can set to use with future log messages
(although, that concept has been discussed)
With a better understanding of the bigger problem (as opposed to the
narrow question of how to set a variable inside rsyslog), it may be
possible to come up with some other solution.
we plan to use rsyslog on our hosts that are automatically created
(EC2) and send these logs to a remote location (aggregate them somewhere).
The messages that are being sent out should have some kind of host
identification. I think the best way to identify EC2 host is EC2 public
ip (I can get that by running ec2metadata).
Hostname of EC2 hosts is not very useful (example of what hostname
command prints: domU-12-31-39-0A-50-42)
This should be hostname or IP of the host where rsyslog is running
(i.e. not from the received message)
thanks,
erik
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE
THAT.