Log-Saftpresse

 view release on metacpan or  search on metacpan

lib/Log/Saftpresse/Counters.pm  view on Meta::CPAN

package Log::Saftpresse::Counters;

use Moose;

# ABSTRACT: objects to hold and manipulate counters
our $VERSION = '1.6'; # VERSION

use Carp;

has 'counters' => (
	is => 'ro', isa => 'HashRef', lazy => 1,
	default => sub { {} },
);

sub incr_one {
	my $self = shift;
	return $self->incr(@_, 1);
}

sub incr {
	my $self = shift;

lib/Log/Saftpresse/Input/Lumberjack.pm  view on Meta::CPAN

use Log::Saftpresse::Log4perl;

# ABSTRACT: lumberjack server input plugin for saftpresse
our $VERSION = '1.6'; # VERSION

extends 'Log::Saftpresse::Input::Server';

use Net::Lumberjack::Reader;

has 'readers' => (
  is => 'ro', isa => 'HashRef[Net::Lumberjack::Reader]',
  default => sub { {} },
);

sub handle_cleanup_connection {
  my ( $self, $conn ) = @_;
  delete $self->readers->{"$conn"};
  return;
}

sub _get_reader {

lib/Log/Saftpresse/Output/Elasticsearch.pm  view on Meta::CPAN

has 'cxn_pool' => ( is => 'rw', isa => 'Str', default => 'Static' );
has 'type' => ( is => 'rw', isa => 'Str', default => 'log' );

has 'indices_template' => (
	is => 'rw', isa => 'Str', default => 'saftpresse-%Y-%m-%d' );

has 'template_name' => ( is => 'ro', isa => 'Str', default => 'saftpresse' );
has 'install_template' => ( is => 'ro', isa => 'Bool', default => 1 );
has 'template_file' => ( is => 'ro', isa => 'Maybe[Str]' );

has '_template_body' => ( is => 'ro', isa => 'HashRef', lazy => 1,
  default => sub {
    my $self = shift;
    my $json_text;
    if( defined $self->template_file ) {
      $json_text = read_file( $self->template_file );
    } else {
      $json_text = read_file( \*DATA );
    }
    return( from_json( $json_text ) );
  },

lib/Log/Saftpresse/Plugin/GeoIP.pm  view on Meta::CPAN


use Moose;

# ABSTRACT: plugin to lookup geoip database
our $VERSION = '1.6'; # VERSION

extends 'Log::Saftpresse::Plugin';

has 'address_fields' => ( is => 'ro', isa => 'Str', default => 'client_ip' );

has '_address_fields' => ( is => 'ro', isa => 'ArrayRef', lazy => 1,
	default => sub {
		my $self = shift;
		return( [ split(/\s*,\s*/, $self->address_fields) ] );
	},
);

use Geo::IP;

sub process {
	my ( $self, $stash ) = @_;

lib/Log/Saftpresse/Plugin/Syslog.pm  view on Meta::CPAN

	if( defined $event ) {
		$self->incr_one('events', 'by_host', $event->{'host'} );
		$self->incr_one('events', 'by_program', $event->{'program'} );
		@$stash{ keys %$event } = values %$event;
	}

	return;
}

has priorities => (
	is => 'ro', isa => 'ArrayRef', lazy => 1,
	default => sub { [
		'emerg',
		'alert',
		'crit',
		'error',
		'warn',
		'notice',
		'info',
		'debug',
	] },
);

has facilities => (
	is => 'ro', isa => 'ArrayRef', lazy => 1,
	default => sub { [
		'kernel',
		'user',
		'mail',
		'daemon',
		'auth',
		'syslog',
		'printer',
		'news',
		'uucp',



( run in 0.303 second using v1.01-cache-2.11-cpan-5f2e87ce722 )