/usr/sbin/octo_replay is in octopussy 1.0.6-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #!/usr/bin/perl -w
=head1 NAME
octo_replay - Octopussy Replay program
=head1 SYNOPSIS
octo_replay --device <device> --service <service> --begin YYYYMMDDHHMM --end YYYYMMDDHHMM
=head1 DESCRIPTION
octo_replay is the program used by the Octopussy Project
to replay Logs for some Device / Service
(it gets 'recognized' logs and put it back in Incoming directory)
=cut
use strict;
use warnings;
use Readonly;
use Getopt::Long;
Getopt::Long::Configure('bundling');
use AAT::Utils qw( ARRAY );
use Octopussy;
use Octopussy::Device;
use Octopussy::FS;
use Octopussy::Logs;
use Octopussy::Storage;
Readonly my $PROG_NAME => 'octo_replay';
Readonly my $PROG_VERSION => Octopussy::Version();
my $help;
my ($opt_device, $opt_service, $opt_begin, $opt_end) =
(undef, undef, undef, undef);
my $file_pid = undef;
my $cache = undef;
=head1 FUNCTIONS
=head2 Help()
Prints Help
=cut
sub Help
{
my $help_str = <<"EOF";
$PROG_NAME (version $PROG_VERSION)
Usage: $PROG_NAME --device <device> --service <service>
--begin YYYYMMDDHHMM --end YYYYMMDDHHMM
EOF
print $help_str;
if (!defined $opt_device)
{
print ' ' . Octopussy::Device::String_List(undef) . "\n";
}
elsif (!defined $opt_service)
{
print ' '
. Octopussy::Device::String_Services(ARRAY($opt_device)) . "\n";
}
print "\n";
exit;
}
#
# MAIN
#
exit if (!Octopussy::Valid_User($PROG_NAME));
my $status = GetOptions(
'h' => \$help,
'help' => \$help,
'device=s' => \$opt_device,
'service=s' => \$opt_service,
'begin=s' => \$opt_begin,
'end=s' => \$opt_end,
);
Help()
if ((!$status)
|| ($help)
|| (!defined $opt_device)
|| (!defined $opt_service)
|| (!defined $opt_begin)
|| (!defined $opt_end));
my $dir_incoming = Octopussy::Storage::Directory_Incoming($opt_device)
. "$opt_device/Incoming/";
my ($files, $total) =
Octopussy::Logs::Get_TimePeriod_Files($opt_device, $opt_service, $opt_begin,
$opt_end);
foreach my $min (sort keys %{$files})
{
my @logs = ();
foreach my $f (@{$files->{$min}})
{
my $cat = ($f =~ /.+\.gz$/ ? 'zcat' : 'cat');
if (defined open my $FILE, '-|', "$cat \"$f\"")
{
while (<$FILE>) { push @logs, $_; }
close $FILE;
unlink $f;
}
}
if ($min =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})$/)
{
my $incoming = $dir_incoming . "$1/$2/$3/msg_${4}h${5}_00.log";
if (defined open my $INCOMING, '>', $incoming)
{
foreach my $l (sort @logs) { print {$INCOMING} $l; }
close $INCOMING;
Octopussy::FS::Chown($incoming);
}
}
}
=head1 AUTHOR
Sebastien Thebert <octo.devel@gmail.com>
=head1 SEE ALSO
octo_dispatcher, octo_extractor, octo_parser, octo_uparser, octo_reporter, octo_scheduler
=cut
|