1755751 Members
4688 Online
108837 Solutions
New Discussion юеВ

Re: Regex Question...

 
Allanm
Super Advisor

Regex Question...

Attaching a perl script, which is failing with the following text in the log -

2010-09-23 17:44:32 REGEX: No blocks for 'ReviewService running on 8541' found.


Regex that the script is using is

time=\s*([0-9\.,]+)

The text on which its failing is the following which clearly has "time=". Can someone suggest a solution?

box3.zap.com ReviewService running on 8541 HTTP OK: HTTP/1.0 200 JBOSS - 9180 bytes in 0.283 second response time time=0.282611s;;;0.000000 size=9180B;;;0 1285289027

Thanks,
Allan.
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor

Re: Regex Question...

Hi Allanm:

I don't see the regex you cite in your attachment.

I fail to see what the data line beginning with "2010-0923" has to do with a match to the regex either.

As for the line beginning with "box3.zap", the regex cited *will* match and will return the time value in $1:

# X="box3.zap.com ReviewService running on 8541 HTTP OK: HTTP/1.0 200 JBOSS - 9180 bytes in 0.283 second response time time=0.282611s;;;0.000000 size=9180B;;;0 1285289027"

# echo ${X}|perl -nle 'perl -nle 'm{time=\s*([0-9\.,]+)} and print $1'
0.282611

Regards!

...JRF...
Allanm
Super Advisor

Re: Regex Question...

Thanks for replying JRF!

Here is the config that the script refers to -

##
define ngraph{
service_name HTTP
graph_perf_regex time=\s*([0-9\.,]+)
graph_value http_res
graph_units seconds
graph_legend HTTP response time
rrd_plottype AREA
rrd_color c0c0ff
}

define ngraph{
service_name HTTP
type CDEF
graph_value http_cdef
graph_units
graph_legend
graph_calc http_res
rrd_plottype LINE1
rrd_color 000000
}

# [EOF]

I am not sure why its logging -

REGEX: No blocks for ...

even though the regex is found.

Thats my question...

Thanks,
Allan