}
/*
 * Build SQL request
 */
$pearDB = new syslogDB("centreon");
$pearDB_syslog = new SyslogDB("syslog", $collector_id);
$cfg_syslog = getSyslogOption($collector_id);
$sql_filter = array();
if (isset($_GET['program']) && $_GET['program'] != "" && $_GET['program'] != "undefined") {
    array_push($sql_filter, " (program = '" . htmlentities($_GET['program'], ENT_QUOTES) . "') ");
}
if (isset($_GET['hostgroup']) && $_GET['hostgroup'] != "" && $_GET['hostgroup'] != "undefined") {
    array_push($sql_filter, " (host IN (" . getSyslogHostFromHostgroups($_GET['hostgroup']) . ")) ");
} else {
    if (isset($_GET['host']) && $_GET['host'] != "" && $_GET['host'] != "undefined") {
        array_push($sql_filter, " (host IN (" . getSyslogHostFromCentreon($_GET['host']) . ")) ");
    } else {
        if ($is_admin) {
            array_push($sql_filter, " (host IN (" . getFullSyslogHostFromCentreon($collector_id, $aclHostString) . ")) ");
        } else {
            array_push($sql_filter, " (host IN (" . getAllSyslogHostFromCentreon($collector_id, $aclHostString) . ")) ");
        }
    }
}
if (isset($_GET['facility']) && $_GET['facility'] != "" && $_GET['facility'] != "undefined") {
    if (strcmp($Ffacility_selected, "") == 0 || strcmp($Ffacility_selected, "eq") == 0) {
        array_push($sql_filter, " (facility = '" . htmlentities($_GET['facility'], ENT_QUOTES) . "') ");
    } else {
        $list_facilities = getListOfFacilities($_GET['facility'], $Ffacility_selected);
        $list = "";
        $listKeys = array_keys($list_facilities);
 } else {
     $FilterHostGroups = $aclHostGroups;
 }
 $FilterHosts = getFilterHostsACL($aclHostString, $collector, $is_admin);
 $FilterPrograms = getFilterProgramsMerge($pearSyslogDB, $cfg_syslog);
 $FilterFacilities = getFilterFacilitiesMerge();
 $FilterPriorities = getFilterPrioritiesMerge();
 $sql_filter = array();
 if (isset($filter_program)) {
     array_push($sql_filter, " (program = '" . htmlentities($filter_program, ENT_QUOTES) . "') ");
 }
 if (isset($filter_hostgroup) && $filter_hostgroup != "" && $filter_hostgroup != "undefined") {
     array_push($sql_filter, " (host IN (" . getSyslogHostFromHostgroups($filter_hostgroup) . ")) ");
 } else {
     if (isset($filter_host) && $filter_host != "" && $filter_host != "undefined") {
         array_push($sql_filter, " (host IN (" . getSyslogHostFromCentreon($filter_host) . ")) ");
     } else {
         if ($is_admin) {
             array_push($sql_filter, " (host IN (" . getFullSyslogHostFromCentreon($collector, $aclHostString) . ")) ");
         } else {
             array_push($sql_filter, " (host IN (" . getAllSyslogHostFromCentreon($collector, $aclHostString) . ")) ");
         }
     }
 }
 if (isset($filter_facility)) {
     if (strcmp($filter_Ffacility, "") == 0 || strcmp($filter_Ffacility, "eq") == 0) {
         array_push($sql_filter, " (facility = '" . htmlentities($filter_facility, ENT_QUOTES) . "') ");
     } else {
         $list_facilities = getListOfFacilities($filter_facility, $filter_Ffacility);
         $list = "";
         $listKeys = array_keys($list_facilities);