NAME

IPTables::Log::Set - Holds a set of IPTables::Log::Set::Record objects.

SYNOPSIS

Note that this class isn't designed to be created directly. You can create these objects via a IPTables::Log object.

use IPTables::Log;
my $l = IPTables::Log->new;
my $s = $l->create_set;

DEPENDENCIES

  • Class::Accessor - for accessor methods

  • Data::GUID - for GUID generation

  • NetAddr::IP - for the src and dst methods (required by IPTables::Log::Set::Record)

CONSTRUCTORS

Set->create

Creates a new IPTables::Log::Set object. This isn't the recommended way to do this, however. The proper way is to create an object via a IPTables::Log object with create_set.

METHODS

$set->create_record({text = '...IN=eth0 OUT=eth1 MAC=00:...'}>))

Creates a new IPTables::Log::Set::Record object. This is the recommended way to create IPTables::Log::Set::Record objects, as it ensures various settings are inherited from the Log class.

The text of the log entry can be passed here, or it can be passed with the set_text accessor method to the IPTables::Log::Set::Record object itself.

$set->load_file($filename)

Loads in logs from $filename, discarding any which don't appear to be iptables/netfilter logs. A IPTables::Log::Set::Record object is then created for each entry, and the content is then parsed. Finally, each entry is then added to the set created with create_record.

$set->add($record)

Adds a IPTables::Log::Set::Record object to a set created with create_set.

$set->get_by('field')

Returns a hash of record identifiers, indexed by field. Field can be one of guid, date, time, hostname, prefix, in, out, mac, src, dst, proto, spt, dpt, id, len, ttl, df, window, syn.

If you attempt to sort on a field that isn't present in all records in the set, get_by will only return records which have that field. For example, if you attempt to get_by('dpt'), any ICMP log messages will be silently excluded from the returned set.

CAVEATS

None.

BUGS

None that I'm aware of ;-)

AUTHOR

This module was written by Andy Smith <andy.smith@netprojects.org.uk>.

COPYRIGHT

$Id: Set.pm 21 2010-12-17 21:07:37Z andys $

(c)2009 Andy Smith (http://andys.org.uk/)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.