Rainer Gerhards wrote:
> Hi all,
>
> I just received an interesting patch via the bug tracker:
>
> http://bugzilla.adiscon.com/show_bug.cgi?id=213
>
> What I see looks good to me, but I am not really in into MySQL. Do you think
> this is something I should merge? If not, why not? I'll wait until monday and
> will merge if I have not heard any good argument against that.
It says the config file is taken from one of the following locations:
======
my.cnf
.my.cnf
~/.my.cnf
/etc/my.cnf
======
The first two depend on CWD. I'm not a fan of locating configuration files
based on the current working directory. That leads to trouble,
particularly because CWD is searched before absolute path locations. So if
a file called my.cnf somehow ends in rsyslogd CWD (which is probably / by
default, but I haven't checked), rsyslogd will change its behavior, which
is bad.
I would prefer having a directive in the rsyslog configuration file which
can specify my.cnf location. If more than one instance of ommysql is used
each one should have its own (I suppose that works out of the box). If
that directive is missing, fall back to:
1. ~/.my.cnf
2. compile-time directive (defaults to $prefix/etc/my.cnf)
There is a problem with NFS mounted programs and Solaris zones (and maybe
AIX which recently got something like Solaris zones). In such settings
you'd have programs (mysql, in this case) in /opt/foo/bin and the default
location for the config file wil be /etc/opt/foo/prog.conf. That allows
mounting /opt/foo read-only and having configuration file in the writeable
part of the file system.
The compile-time directive should take a list of directories, so one could
specify:
./configure --with-mysql-config=/etc/opt/foo/my.cnf:/opt/foo/etc/my.cnf
The configure script could autodetect such things (if $prefix is /opt/foo,
then use the above default), but if that's too much work, just leave it to
the person who is compiling the source.
I wouldn't use CWD to locate any configuration file.
You could also try locating the config file in run-time based on the
location of the mysql client library. That is not portable, but it would
work on systems which have dlinfo() implemented (Solaris, Linux and
FreeBSD, at least). In that case you'd get an installation prefix for the
mysql client library via dladdr() and dlinfo() and then try to guess the
config file location. That might be somewhat problematic, though, in cases
when the location is something like /usr/lib64/mysql/libmysqlclient.so.15.
If the above run-time detection is implemented, than it should be in
addition to the hard-coded locations, not instead of them. And the
configure script should have a directive to disable that code (or to
enable it, if disabled by default).
--
.-. .-. Yes, I am an agent of Satan, but my duties are largely
(_ \ / _) ceremonial.
|
| [email protected]
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com