[icinga-checkins] icinga.org: icingaweb2-module-logstash/master: Fix warning/ critical filtering

git at icinga.org git at icinga.org
Fri Feb 5 14:05:50 CET 2016


Module: icingaweb2-module-logstash
Branch: master
Commit: 2906f6842304f8e6a8277e0307895f071a6b346f
URL:    https://git.icinga.org/?p=icingaweb2-module-logstash.git;a=commit;h=2906f6842304f8e6a8277e0307895f071a6b346f

Author: Markus Frosch <markus at lazyfrosch.de>
Date:   Wed Nov 18 12:15:33 2015 +0100

Fix warning/critical filtering

Warning filters were not applied correctly, and it was not supported that only warning or critical to be filtered, not both.

---

 library/Logstash/Search.php |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/library/Logstash/Search.php b/library/Logstash/Search.php
index 0842c72..293a35d 100644
--- a/library/Logstash/Search.php
+++ b/library/Logstash/Search.php
@@ -6,6 +6,7 @@ use Icinga\Data\Filter\Filter;
 use Icinga\Data\Limitable;
 use Icinga\Data\Sortable;
 use Icinga\Data\QueryInterface;
+use Icinga\Exception\IcingaException;
 use Icinga\Exception\ProgrammingError;
 use Exception;
 
@@ -431,6 +432,7 @@ class Search extends ElasticsearchBackend implements QueryInterface
 
     /**
      * @param boolean $filtered_by_icinga_queries
+     * @throws IcingaException
      */
     public function setFilteredByIcingaQueries($filtered_by_icinga_queries)
     {
@@ -438,14 +440,14 @@ class Search extends ElasticsearchBackend implements QueryInterface
 
         if ($filtered_by_icinga_queries) {
             $filter = array();
-            if ($qs = $this->getIcingaCriticalQuery()->getQueryString()) {
+            if ($this->getIcingaWarningQuery() and $qs = $this->getIcingaWarningQuery()->getQueryString()) {
                 $filter[] = $this->buildFilterQueryString($qs, 'or');
             }
-            if ($qs = $this->getIcingaCriticalQuery()->getQueryString()) {
+            if ($this->getIcingaCriticalQuery() and $qs = $this->getIcingaCriticalQuery()->getQueryString()) {
                 $filter[] = $this->buildFilterQueryString($qs, 'or');
             }
             if (count($filter) == 0)
-                throw new Exception("There are no Icinga queries to be filtered with!");
+                throw new IcingaException('There are no Icinga queries to be filtered with!');
 
             $this->filter_icinga = array('or' => $filter);
         }



More information about the icinga-checkins mailing list