Log::Syslog::UDP - Perl extension for very quickly sending syslog messages over UDP.
use Log::Syslog::UDP; my $logger = Log::Syslog::UDP->new("127.0.0.1", 514, 16, 6, "mymachine", "logger"); $logger->send("log message", time);
This module sends syslog messages over a non-blocking UDP socket. It works like Sys::Syslog in setlogsock('udp') mode, but without the significant CPU overhead of that module when used for high-volume logging. Use of this specialized module is only necessary if 1) you must use UDP syslog as a messaging transport but 2) need to minimize the time spent in the logger.
Create a new Log::Syslog::UDP object with the following parameters:
The destination hostname where a syslogd is running.
The destination port where a syslogd is listening. Usually 514.
The syslog facility constant, eg 16 for 'local0'. See RFC3164 section 4.1.1 (or <sys/syslog.h>) for appropriate constant values.
The syslog severity constant, eg 6 for 'info'. See RFC3164 section 4.1.1 (or <sys/syslog.h>) for appropriate constant values.
The originating hostname. Sys::Hostname::hostname is typically a reasonable source for this.
The program name or tag to use for the message.
Send a syslog message through the configured logger. If $time is not provided, CORE::time() will be called for you. That doubles the syscalls per message, so try to pass it if you're calling time() yourself already.
Change the destination host and port.
Change the syslog facility and severity.
Change what is sent as the hostname of the sender.
Change what is sent as the name of the sending program.
Change what is sent as the process id of the sending program.
You may optionally import constants for severity and facility levels.
use Log::Syslog::UDP qw(:severities); # LOG_CRIT, LOG_NOTICE, LOG_DEBUG, etc use Log::Syslog::UDP qw(:facilities); # LOG_CRON, LOG_LOCAL3, etc use Log::Syslog::UDP qw(:all); # all of the above
Sys::Syslog
Adam Thomason, <athomason@sixapart.com>
Copyright (C) 2008 by Six Apart, Ltd.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install Log::Syslog::UDP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Syslog::UDP
CPAN shell
perl -MCPAN -e shell install Log::Syslog::UDP
For more information on module installation, please visit the detailed CPAN module installation guide.