Net::Frame::Layer::Syslog - Syslog layer object
use Net::Frame::Simple; use Net::Frame::Layer::Syslog qw(:consts); my $layer = Net::Frame::Layer::Syslog->new( facility => NF_SYSLOG_FACILITY_LOCAL7, severity => NF_SYSLOG_SEVERITY_INFORMATIONAL, timestamp => (current time MMM DD HH:MM:SS), host => (hostname), tag => ($0[$$]), content => 'syslog message', ); # # Read a raw layer # my $layer = Net::Frame::Layer::Syslog->new(raw => $raw); print $layer->print."\n"; print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n" if $layer->payload;
This modules implements the encoding and decoding of the Syslog layer.
See also Net::Frame::Layer for other attributes and methods.
Syslog facility. See CONSTANTS for more information.
Syslog severity. See CONSTANTS for more information.
Timestamp. Default is set to current time in format: MMM DD HH:MM:SS
Hostname. Default is set to current host.
Tag. Default is set to: program_name[process_id]
The following are inherited attributes. See Net::Frame::Layer for more information.
Object constructor. You can pass attributes that will overwrite default ones. See SYNOPSIS for default values.
<###>Mmm dd hh:mm:ss hostname tag content |___||_____________| |______| |_________| | Timestamp Hostname Message | Priority -> (facility and severity)
Object constructor. Same as new but only takes message as input. Value of message is the entire Syslog message. This allows custom messages that do not follow strict RFC 3164 guidelines. Default message is same as constructed with new.
The following are inherited methods. Some of them may be overriden in this layer, and some others may not be meaningful in this layer. See Net::Frame::Layer for more information.
Load them: use Net::Frame::Layer::Syslog qw(:subs);
Takes Syslog facility and severity and returns priority.
Takes Syslog priority and returns numeric facility and severity. Optional flag returns facility and severity names.
my ($facility, $severity) = priorityNtoa( ... )
Load them: use Net::Frame::Layer::Syslog qw(:consts);
Copyright (c) 2012, Michael Vincent
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.