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.

David Lang

_______________________________________________
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.

Reply via email to