On 9/14/2012 3:23 AM, Jaspal Kaur wrote:
>
> Below is my rule and here is input string : AuthorizationStatus:1 ,
> Result:1
>
>
>
> type=Single
>
> ptype=RegExp
>
> pattern=.* INTEGER: (\S+),.* INTEGER: (\S+)
>
> desc= AuthorizationStatus:$1 , Result:$2
>
> action=write /var/mps/sec_output_fifo.txt
>
>
>
> Right now , its writing AuthorizationStatus:1 Result:1, but I want to
> write AuthorizationStatus: Authorized , Result: Successful
>
>
>
> Can somebody please help me on this?
>
>
>
Make sure you have -intevents enabled, and create an initialization rule
-- I usually use a library, e.g.:
# load library module on startup/reload
type=Single
ptype=RegExp
continue=TakeNext
pattern=(SEC_STARTUP|SEC_RESTART|SEC_SOFTRESTART)
desc=SEC Initialization
context=SEC_INTERNAL_EVENT
action=eval %o (require '/wm/lib/perl/WM/SEC/init.pl'; 1)
I also sometimes have a calendar rule to reload that periodically if the
contents have changed.
In your library file, you can do all sorts of stuff, like:
%AuthCodeMap = (
1 => 'Authorized',
);
%ResultCodeMap = (
1 => 'Successful',
);
1;
You can't directly reference that in your desc= statement, but you can
create an intermediate rule that transforms the data based on that hash,
then use the transformation results. Or you can keep desc= as-is and
use the hash directly in your action statement:
type=Single
ptype=RegExp
pattern=.* INTEGER: (\S+),.* INTEGER: (\S+)
desc= AuthorizationStatus:$1 , Result:$2
action=eval %e { "AuthorizationStatus:$AuthCodeMap{$1},
Result:$ResultCodeMap{$2}" }; write /var/mps/sec_output_fifo.txt %e
Note this is hand-written and untested, but hopefully gives you an idea
of how to proceed. I would probably use a sub instead of a map so I
could gracefully handle unknown codes (this version would result in
undefined values). That would also make it easier to load those from a
file rather than directly embed the map into the library code.
Regards,
Mark
--
Mark D. Nagel, CCIE #3177 <[email protected]>
Principal Consultant, Willing Minds LLC (http://www.willingminds.com)
cell: 949-279-5817, desk: 714-495-4001, fax: 714-646-8277
** For faster support response time, please
** email [email protected] or call 714-495-4000
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users