Net::Nmsg::Output - Perl interface for nmsg outputs
use Net::Nmsg::Input;
use Net::Nmsg::Output;
my $in = Net::Nmsg::Input->open('input.nmsg');
my $out = Net::Nmsg::Output->open('output.nmsg');
my $c = 0;
while (my $msg = <$in>) {
print "got message $c $msg\n";
$out->write($msg);
++$c;
}
# alternatively:
my $cb = sub {
print "got message $c ", shift, "\n"
$out->write($msg);
++$c;
};
$in->loop($cb);
Net::Nmsg::Output provides the perl interface for the Net::Nmsg::XS::output extension.
Creates and opens new output object. The output can be specified as a file name or handle, callback reference, or socket.
Options, where applicable, also apply to the more specific open calls detailed further below. Available options:
Restricts the output to messages of the given vendor and msgtype. Both are required if filtering is desired.
Set the source, operator, and group fields on outputs (nmsg only)
Control whether or not the output socket is buffered (default: 1).
Enable or disable zlib compression of output (nmsg only)
Limit the payload output rate
Set the buffer size for the output (the default value is based on whether the output is a file or socket)
Set broadcast mode (socket only)
Set send buffer size (socket only)
Set the line ending character for presentation outputs.
Opens an output in nmsg format, as specified by file name or file handle.
Opens an output in JSON format, as specified by file name or file handle.
Opens an output socket as specified by "host/port" or socket handle. The host and port can also be provided as separate arguments.
Opens an output in presentation format, as specified by file name or file handle. The 'filter_vendor' and 'filter_msgtype' options are required.
Opens a callback output using the provided code reference. The callback will be invoked with a Net::Nmsg::Msg reference each time a message is 'written' to the output.
Write the given Net::Nmsg::Msg object to this output.
Net::Nmsg, Net::Nmsg::IO, Net::Nmsg::Input, Net::Nmsg::Msg, nmsgtool(1)
Matthew Sisk, <sisk@cert.org>
Copyright (C) 2010-2015 by Carnegie Mellon University
Use of the Net-Silk library and related source code is subject to the terms of the following licenses:
GNU General Public License (GPL) Rights pursuant to Version 2, June 1991 Government Purpose License Rights (GPLR) pursuant to DFARS 252.227.7013
NO WARRANTY
See GPL.txt and LICENSE.txt for more details.