Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nathanejohnson/lib_mysqludf_syslog

mysql UDF that allows for logging to syslog
https://github.com/nathanejohnson/lib_mysqludf_syslog

Last synced: 26 days ago
JSON representation

mysql UDF that allows for logging to syslog

Awesome Lists containing this project

README

        

Syslog libary for MySQL.
Copyright (C) [Nathan Johnson ]

Function is called as:
syslog_write(facility, priority, ident, log_message)

where facility is one of:

'LOG_AUTH' The authorization system: login(1), su(1), getty(8), etc.

'LOG_AUTHPRIV' The same as LOG_AUTH, but logged to a file readable only by selected individuals.

'LOG_USER' Messages generated by random user processes. This is the default facility identifier if none is specified.

'LOG_DAEMON' system daemons without separate facility value

'LOG_LOCAL0'-'LOG_LOCAL7' Reserved for local use. Similarly for LOG_LOCAL1 through LOG_LOCAL7.

and priority is one of:

LOG_EMERG system is unusable

LOG_ALERT action must be taken immediately

LOG_CRIT critical conditions

LOG_ERR error conditions

LOG_WARNING warning conditions

LOG_NOTICE normal, but significant, condition

LOG_INFO informational message

LOG_DEBUG debug-level message

ident is prepended to every message, and is typically set to the application name
message is what is meant to be sent to syslog

facility, priority and identity should be constant strings. i.e., they should not change while iterating over a result set

to compile (on linux, for example):
````
gcc `mysql_config --cflags` -fPIC -shared -o lib_mysqludf_syslog.so lib_mysqludf_syslog.c
````

NOTE: most likely this will never compile on Windows, though it is vaguely possible that it could interface with syslog installed via cygwin.

to create function:
````
create function lib_mysqludf_syslog_info returns string soname 'lib_mysqludf_syslog.so';
create function syslog_write returns integer soname 'lib_mysqludf_syslog.so';
````
after copying syslog_udf.so to the appropriate place (plugin dir), or setting LD_LIBRARY_PATH as per the documentation

This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA