I want to grab a string from a log line, return a hash value, and write that
hash value
e.g. I grab an integer from a log line and want to write a color
LOG LINE
2017-07-25T04:31:10-07:00 server-foo ... down: 3 ....
PSEUDO-SEC CONFIG
%hash = ( 1 => red, 2 => green, 3 => blue );
type=Single
ptype=RegExp
pattern=down: (\d+)
{somehow translate '3' into 'blue'}
action = write - "Blue is down"
MAN PAGE
I'm reading https://simple-evcorr.github.io/man.html , focused on the Perl
Integration section.
type=Jump
ptype=PerlFunc
pattern = sub {
my %hash = ( 1 => red, 2 => green, 3 => blue );
my $line = $_[0];
my ($node) = ($line) =~ /down: (\d+)/;
my $color = $hash{$node};
return $color;
}
QUESTION
* Am I headed in the right direction?
* Where would you point me next, in terms of reading about how to propagate
"$color" into an 'action' line?
--sk
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users