Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: question on log_watcher input

by adewolf38 (Initiate)
on Sep 09, 2015 at 21:24 UTC ( [id://1141467]=note: print w/replies, xml ) Need Help??


in reply to Re: question on log_watcher input
in thread question on log_watcher input

Here is the config file contents:
offset: 1 orchestral execution mail 1

The config file is tab seperated. I am trying to use more than one string, "orchestral", and then later in the string is "execution". They are on the same line in the log.

NOTE: This is a proof of concept. I am looking for two separate strings in an error message from the log.

log example:

"at com.orchestral.rhapsody.execution.route.spi.conditions.ConnectorExecutor.accepts(ConnectorExecutor.java:4)"

Replies are listed 'Best First'.
Re^3: question on log_watcher input
by marinersk (Priest) on Sep 10, 2015 at 00:27 UTC

    To answer your original question:

    This line of code extracts the search string from the config file:

    ($string[$i], $action[$i], $actionargs[$i], $numrows[$i]) = split /\t+/, $_;

    And this line decides if the logfile has a match:

    if ($_ =~ /$string[$str_index]/i) {

    As far as I can tell, if you were to put a regular expression in for your string in the config file, it would directly interpret it as such. This is a direct conflict with your statement that it doesn't take regular expressions.

    Have you tried

    orchestral.*execution mail 1

    at all? Because unless I'm missing something (and I sort of skimmed the code so it's of course possible), it sure looks to me like it would work.

      Yes sir that did work. I had previously tried (?=orchestral)(?=execution) , or just /orchestral/ /execution/ and some others. I'm still learning Perl and regex. Thanks very much for your input.

        Glad it worked!

Re^3: question on log_watcher input
by marinersk (Priest) on Sep 10, 2015 at 00:09 UTC

    Perhaps this will give you some ideas. Using the following test data:

    Something bad happened with orchestral stuff at com.orchestral.rhapsody.execution.route.spi.conditions.ConnectorExe +cutor.accepts(ConnectorExecutor.java:4) and I don't know what to do about this execution failure but execution of orchestral stuff is important

    This script:

    Produced these results:

    D:\PerlMonks>parse1.pl orchestral execution -----[ Must occur in the order given ]----- Match: [at com.orchestral.rhapsody.execution.route.spi.conditions.Con +nectorExecutor.accepts(ConnectorExecutor.java:4)] -----[ May occur in any order ]----- Match: [at com.orchestral.rhapsody.execution.route.spi.conditions.Con +nectorExecutor.accepts(ConnectorExecutor.java:4)] Match: [but execution of orchestral stuff is important] -----[ Done]-----

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1141467]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found