App-Sysadmin-Log-Simple

 view release on metacpan or  search on metacpan

lib/App/Sysadmin/Log/Simple.pm  view on Meta::CPAN

}

sub run_command_view {
    my $self = shift;
    PLUGIN: foreach my $plugin ( $self->plugins(app => $self) ) {
        next PLUGIN unless $plugin->can('view');
        $plugin->view();
    }
}


1;

__END__

=pod

=encoding utf-8

=head1 NAME

App::Sysadmin::Log::Simple - application class for managing a simple sysadmin log

=head1 VERSION

version 0.009

=head1 SYNOPSIS

    require App::Sysadmin::Log::Simple;
    App::Sysadmin::Log::Simple->new()->run();

=head1 DESCRIPTION

C<App::Sysadmin::Log::Simple> provides an easy way to maintain a simple
single-host system administration log.

The log is single-host in the sense that it does not log anything about
the host. While you can obviously state what host you're talking about
in your log entry, there is nothing done automatically to differentiate
such log entries, and there is no built-in way to log from one host to
another.

The logs themselves are also simple - you get a single line of plain
text to say what you have to say. That line gets logged in a fashion
that is easy to read with this script, with cat, or it can be parsed
with L<Text::Markdown> (or L<Text::MultiMarkdown>, which is a more
modern drop-in replacement) and served on the web.

If you need more than a single line of text, you may wish to use that
line to point to a pastebin - you can easily create and retrieve them
from the command line with L<App::Pastebin::sprunge>.

There is also no way to audit that the logs are correct. It can be
incorrect in a number of ways:

=over 4

=item * SUDO_USER or USER can be spoofed

=item * The files can be edited at any time, they are chmod 644 and
owned by an unprivileged user

=item * The timestamp depends on the system clock

=item * ...etc

=back

Nonetheless, this is a simple, easy, and B<fast> way to get a useful
script for managing a simple sysadmin log. We believe the 80/20 rule
applies: You can get 80% of the functionality with only 20% of a
"real" solution. In the future, each log entry might be committed to
a git repository for additional tracking.

=head1 METHODS

=head2 new

Obviously, the constructor returns an C<App::Sysadmin::Log::Simple>
object. It takes a hash of options which specify:

=over 4

=item * logdir

The directory where to find the sysadmin log. Defaults to
F</var/log/sysadmin>.

=item * user

The user who owns the sysadmin log. Should be unprivileged,
but could be anything. Defaults to the current user.

=item * date

The date to use instead of today.

=item * udp

A hashref of data regarding UDP usage. If you don't want to
send a UDP datagram, omit this. Otherwise, it has the following
structure:

    my %udp_data = (
        irc => 1,           # Whether to insert IRC colour codes
        host => 'localhost',# What hostname to send to
        port => 9002,       # What port to send to
    );

=item * http

A hashref of data regarding HTTP usage. If you don't want to
send a HTTP message, omit this. Otherwise, it has the following
structure:

    my %http_data = (
        uri => 'http://localhost', # What uri to send to
        method => 'post',          # What method to send using
    );



( run in 1.565 second using v1.01-cache-2.11-cpan-5b529ec07f3 )