/usr/sbin/octo_msg_finder is in octopussy 1.0.6-0ubuntu2.
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 | #!/usr/bin/perl -w
=head1 NAME
octo_msg_finder - Octopussy message finder program
=head1 SYNOPSIS
octo_msg_finder "<line>" | <filename>
=head1 DESCRIPTION
octo_msg_finder is the program used by the Octopussy Project
to help users to determine to wich Message/Service a log belongs to
=cut
use strict;
use warnings;
use AAT::Utils qw( NOT_NULL );
use Octopussy;
use Octopussy::Message;
use Octopussy::Service;
my @services = Octopussy::Service::List();
=head1 FUNCTIONS
=head2 Search_Line($line, $n)
Prints Service, MsgID, Taxonomy & Table of line $line
=cut
sub Search_Line
{
my ($line, $n) = @_;
$n ||= 1;
my $match = 0;
foreach my $serv (@services)
{
my @msg_to_parse = ();
my @messages = Octopussy::Service::Messages($serv);
foreach my $m (@messages)
{
my $regexp = Octopussy::Message::Pattern_To_Regexp($m);
if ($line =~ /^$regexp\s*[^\t\n\r\f -~]?$/i)
{
$match = 1;
print "\nLine $n: $line\n";
print " --> Service: $serv\n";
print " --> MsgID: $m->{msg_id}\n";
print " --> Taxonomy: $m->{taxonomy}\n";
print " --> Table: $m->{table}\n";
}
}
}
if (!$match)
{
print "\nLine: $line\n";
print " --> MESSAGE UNKNOWN\n";
}
return ($match);
}
my $arg = $ARGV[0];
if (NOT_NULL($arg))
{
my $cat = ($arg =~ /.+\.gz$/ ? 'zcat' : 'cat');
if ( (-f $arg)
&& (defined open my $FILE, '-|', "$cat \"$arg\""))
{
my $i = 1;
while (<$FILE>)
{
Search_Line($_, $i);
$i++;
}
close $FILE;
}
else
{
Search_Line($arg);
}
}
=head1 AUTHOR
Sebastien Thebert <octo.devel@gmail.com>
=head1 SEE ALSO
octo_dispatcher, octo_extractor, octo_parser, octo_uparser, octo_reporter,
octo_scheduler
=cut
|