in reply to question on log_watcher input

Please use <readmore/> tags for long pieces of code.

Are you trying to use more than one "string" in the config file ?
What error message are you getting ?
Is the line that fails TAB separated ?

Please show us the config data and relevant messages.

        Software efficiency halves every 18 months, thus compensating for Moore's Law.

Replies are listed 'Best First'.
Re^2: question on log_watcher input
by adewolf38 (Initiate) on Sep 09, 2015 at 21:24 UTC
    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)"

      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.

      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]-----