diag_logs_settings.php 33 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    Copyright (C) 2014-2015 Deciso B.V.
    Copyright (C) 2007 Seth Mos <seth.mos@dds.nl>
    Copyright (C) 2004-2009 Scott Ullrich
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
Ad Schellevis's avatar
Ad Schellevis committed
30 31
*/

32
require_once("guiconfig.inc");
33
require_once("interfaces.inc");
34
require_once("rrd.inc");
Ad Schellevis's avatar
Ad Schellevis committed
35
require_once("filter.inc");
36
require_once("system.inc");
37
require_once("pfsense-utils.inc");
38
require_once("services.inc");
39

40

41 42
function clear_all_log_files()
{
43 44 45 46 47 48 49 50 51 52 53 54 55 56
    killbyname('syslogd');

    $clog_files = array('dhcpd', 'filter', 'gateways', 'ipsec', 'l2tps', 'lighttpd', 'ntpd', 'openvpn', 'poes',
                        'portalauth', 'ppps', 'pptps', 'relayd', 'resolver', 'routing', 'system','vpn','wireless');
    $log_files = array('squid/access', 'squid/cache', 'squid/store');

    foreach ($clog_files as $lfile) {
        clear_clog("/var/log/{$lfile}.log", false);
    }


    foreach ($log_files as $lfile) {
        clear_log("/var/log/{$lfile}.log", false);
    }
57

58 59 60 61
    system_syslogd_start();
    killbyname('dhcpd');
    services_dhcpd_configure();
}
Ad Schellevis's avatar
Ad Schellevis committed
62 63

function is_valid_syslog_server($target) {
64 65 66 67
    return (is_ipaddr($target)
      || is_ipaddrwithport($target)
      || is_hostname($target)
      || is_hostnamewithport($target));
Ad Schellevis's avatar
Ad Schellevis committed
68 69
}

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    $pconfig = array();
    $pconfig['rrdenable'] = isset($config['rrd']['enable']);
    $pconfig['reverse'] = isset($config['syslog']['reverse']);
    $pconfig['nentries'] = !empty($config['syslog']['nentries']) ? $config['syslog']['nentries'] : 50;
    $pconfig['remoteserver'] = !empty($config['syslog']['remoteserver']) ? $config['syslog']['remoteserver'] : null;
    $pconfig['remoteserver2'] = !empty($config['syslog']['remoteserver2']) ? $config['syslog']['remoteserver2'] : null;
    $pconfig['remoteserver3'] = !empty($config['syslog']['remoteserver3']) ? $config['syslog']['remoteserver3'] : null;
    $pconfig['sourceip'] = !empty($config['syslog']['sourceip']) ? $config['syslog']['sourceip'] : null;
    $pconfig['ipproto'] = !empty($config['syslog']['ipproto']) ? $config['syslog']['ipproto'] : null;
    $pconfig['filter'] = isset($config['syslog']['filter']);
    $pconfig['dhcp'] = isset($config['syslog']['dhcp']);
    $pconfig['portalauth'] = isset($config['syslog']['portalauth']);
    $pconfig['vpn'] = isset($config['syslog']['vpn']);
    $pconfig['apinger'] = isset($config['syslog']['apinger']);
    $pconfig['relayd'] = isset($config['syslog']['relayd']);
    $pconfig['hostapd'] = isset($config['syslog']['hostapd']);
    $pconfig['logall'] = isset($config['syslog']['logall']);
    $pconfig['system'] = isset($config['syslog']['system']);
    $pconfig['enable'] = isset($config['syslog']['enable']);
    $pconfig['logdefaultblock'] = empty($config['syslog']['nologdefaultblock']);
    $pconfig['logdefaultpass'] = empty($config['syslog']['nologdefaultpass']);
    $pconfig['logbogons'] = empty($config['syslog']['nologbogons']);
    $pconfig['logprivatenets'] = empty($config['syslog']['nologprivatenets']);
    $pconfig['loglighttpd'] = empty($config['syslog']['nologlighttpd']);
    $pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions'];
    $pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
    $pconfig['logfilesize'] =  !empty($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!empty($_POST['action']) && $_POST['action'] == "resetlogs") {
        clear_all_log_files();
        $savemsg = gettext("The log files have been reset.");
    } elseif (!empty($_POST['action']) && $_POST['action'] == "ResetRRD") {
        $savemsg = gettext('RRD data has been cleared.');
        mwexec('/bin/rm /var/db/rrd/*');
        enable_rrd_graphing();
        setup_gateways_monitor();
    } else {
        $input_errors = array();
        $pconfig = $_POST;

        /* input validation */
        if (!empty($pconfig['enable']) && !is_valid_syslog_server($pconfig['remoteserver'])) {
            $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1.");
        }
        if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver2']) && !is_valid_syslog_server($pconfig['remoteserver2'])) {
            $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2.");
        }
        if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver3']) && !is_valid_syslog_server($_POST['remoteserver3'])) {
            $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3.");
        }

        if (($pconfig['nentries'] < 5) || ($pconfig['nentries'] > 2000)) {
            $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
        }

        if (!empty($pconfig['logfilesize']) && (strlen($pconfig['logfilesize']) > 0)) {
            if (!is_numeric($pconfig['logfilesize']) || ($pconfig['logfilesize'] < 5120)) {
                $input_errors[] = gettext("Log file size must be a positive integer greater than 5120.");
            }
        }
        if (count($input_errors) == 0) {
            $config['syslog']['reverse'] = !empty($pconfig['reverse']) ? true : false;
            $config['syslog']['nentries'] = (int)$pconfig['nentries'];
            if (isset($_POST['logfilesize']) && (strlen($pconfig['logfilesize']) > 0)) {
                $config['syslog']['logfilesize'] = (int)$pconfig['logfilesize'];
            } elseif (isset($config['syslog']['logfilesize'])) {
                unset($config['syslog']['logfilesize']);
            }
            $config['syslog']['remoteserver'] = $pconfig['remoteserver'];
            $config['syslog']['remoteserver2'] = $pconfig['remoteserver2'];
            $config['syslog']['remoteserver3'] = $pconfig['remoteserver3'];
            $config['syslog']['sourceip'] = $pconfig['sourceip'];
            $config['syslog']['ipproto'] = $pconfig['ipproto'];
            $config['syslog']['filter'] = !empty($pconfig['filter']);
            $config['syslog']['dhcp'] = !empty($pconfig['dhcp']);
            $config['syslog']['portalauth'] = !empty($pconfig['portalauth']);
            $config['syslog']['vpn'] = !empty($pconfig['vpn']);
            $config['syslog']['apinger'] = !empty($pconfig['apinger']);
            $config['syslog']['relayd'] = !empty($pconfig['relayd']);
            $config['syslog']['hostapd'] = !empty($pconfig['hostapd']);
            $config['syslog']['logall'] = !empty($pconfig['logall']);
            $config['syslog']['system'] = !empty($pconfig['system']);
            $config['syslog']['disablelocallogging'] = !empty($pconfig['disablelocallogging']);
            $config['syslog']['enable'] = !empty($pconfig['enable']);
            $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
            $oldnologdefaultpass = isset($config['syslog']['nologdefaultpass']);
            $oldnologbogons = isset($config['syslog']['nologbogons']);
            $oldnologprivatenets = isset($config['syslog']['nologprivatenets']);
            $oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
            $config['syslog']['nologdefaultblock'] = empty($pconfig['logdefaultblock']);
            $config['syslog']['nologdefaultpass'] = empty($pconfig['logdefaultpass']);
            $config['syslog']['nologbogons'] = empty($pconfig['logbogons']);
            $config['syslog']['nologprivatenets'] = empty($pconfig['logprivatenets']);
            $config['syslog']['nologlighttpd'] = empty($pconfig['loglighttpd']);
            if (is_numeric($pconfig['filterdescriptions']) && $pconfig['filterdescriptions'] > 0)
                $config['syslog']['filterdescriptions'] = $pconfig['filterdescriptions'];
            elseif (isset($config['syslog']['filterdescriptions'])) {
                unset($config['syslog']['filterdescriptions']);
            }

            $config['rrd']['enable'] = !empty($pconfig['rrdenable']);

            write_config();

175 176
            system_syslogd_start();

177 178 179
            if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
              || ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass']))
              || ($oldnologbogons !== isset($config['syslog']['nologbogons']))
180 181 182
              || ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
              filter_configure();
            }
183 184 185 186 187 188 189 190 191 192 193 194 195 196

            $savemsg = get_std_save_message();

            if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
              log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
              mwexec_bg('/usr/local/etc/rc.restart_webgui 2');
              $savemsg .= "<br />" . gettext("WebGUI process is restarting.");
            }

            filter_pflog_start();
            enable_rrd_graphing();
            setup_gateways_monitor();
        }
    }
Ad Schellevis's avatar
Ad Schellevis committed
197 198
}

199
legacy_html_escape_form_data($pconfig);
200

Ad Schellevis's avatar
Ad Schellevis committed
201 202 203 204
include("head.inc");
?>


205
<body>
Ad Schellevis's avatar
Ad Schellevis committed
206 207 208
<script type="text/javascript">
//<![CDATA[
function enable_change(enable_over) {
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
  if (document.iform.enable.checked || enable_over) {
    document.iform.remoteserver.disabled = 0;
    document.iform.remoteserver2.disabled = 0;
    document.iform.remoteserver3.disabled = 0;
    document.iform.filter.disabled = 0;
    document.iform.dhcp.disabled = 0;
    document.iform.portalauth.disabled = 0;
    document.iform.vpn.disabled = 0;
    document.iform.apinger.disabled = 0;
    document.iform.relayd.disabled = 0;
    document.iform.hostapd.disabled = 0;
    document.iform.system.disabled = 0;
    document.iform.logall.disabled = 0;
    check_everything();
  } else {
    document.iform.remoteserver.disabled = 1;
    document.iform.remoteserver2.disabled = 1;
    document.iform.remoteserver3.disabled = 1;
    document.iform.filter.disabled = 1;
    document.iform.dhcp.disabled = 1;
    document.iform.portalauth.disabled = 1;
    document.iform.vpn.disabled = 1;
    document.iform.apinger.disabled = 1;
    document.iform.relayd.disabled = 1;
    document.iform.hostapd.disabled = 1;
    document.iform.system.disabled = 1;
    document.iform.logall.disabled = 1;
  }
Ad Schellevis's avatar
Ad Schellevis committed
237 238
}
function check_everything() {
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
  if (document.iform.logall.checked) {
    document.iform.filter.disabled = 1;
    document.iform.filter.checked = false;
    document.iform.dhcp.disabled = 1;
    document.iform.dhcp.checked = false;
    document.iform.portalauth.disabled = 1;
    document.iform.portalauth.checked = false;
    document.iform.vpn.disabled = 1;
    document.iform.vpn.checked = false;
    document.iform.apinger.disabled = 1;
    document.iform.apinger.checked = false;
    document.iform.relayd.disabled = 1;
    document.iform.relayd.checked = false;
    document.iform.hostapd.disabled = 1;
    document.iform.hostapd.checked = false;
    document.iform.system.disabled = 1;
    document.iform.system.checked = false;
  } else {
    document.iform.filter.disabled = 0;
    document.iform.dhcp.disabled = 0;
    document.iform.portalauth.disabled = 0;
    document.iform.vpn.disabled = 0;
    document.iform.apinger.disabled = 0;
    document.iform.relayd.disabled = 0;
    document.iform.hostapd.disabled = 0;
    document.iform.system.disabled = 0;
  }
Ad Schellevis's avatar
Ad Schellevis committed
266
}
267 268 269 270 271 272 273 274

$(document).ready(function() {
    enable_change(false);

    // messagebox, flush all rrd graphs
    $("#ResetRRD").click(function(event){
        event.preventDefault();
        BootstrapDialog.show({
Fabian Franz's avatar
Fabian Franz committed
275
            type:BootstrapDialog.TYPE_DANGER,
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
            title: "<?= gettext("Syslog");?>",
            message: "<?=gettext('Do you really want to reset the RRD graphs? This will erase all graph data.');?>",
            buttons: [{
                    label: "<?= gettext("No");?>",
                    action: function(dialogRef) {
                        dialogRef.close();
                    }}, {
                      label: "<?= gettext("Yes");?>",
                      action: function(dialogRef) {
                        $("#action").val("ResetRRD");
                        $("#iform").submit()
                    }
                }]
        });
    });

      // messagebox, flush all log files
      $("#resetlogs").click(function(event){
          event.preventDefault();
          BootstrapDialog.show({
Fabian Franz's avatar
Fabian Franz committed
296
              type:BootstrapDialog.TYPE_DANGER,
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
              title: "<?= gettext("Syslog");?>",
              message: "<?=gettext('Do you really want to reset the log files? This will erase all local log data.');?>",
              buttons: [{
                      label: "<?= gettext("No");?>",
                      action: function(dialogRef) {
                          dialogRef.close();
                      }}, {
                        label: "<?= gettext("Yes");?>",
                        action: function(dialogRef) {
                          $("#action").val("resetlogs");
                          $("#iform").submit()
                      }
                  }]
          });
      });

});

Ad Schellevis's avatar
Ad Schellevis committed
315 316 317
//]]>
</script>
<?php include("fbegin.inc"); ?>
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
  <section class="page-content-main">
    <div class="container-fluid">
      <div class="row">
<?php
      if (isset($input_errors) && count($input_errors) > 0) {
          print_input_errors($input_errors);
      }
      if (isset($savemsg)) {
          print_info_box($savemsg);
      }
?>
        <section class="col-xs-12">
          <form action="diag_logs_settings.php" method="post" name="iform" id="iform">
            <input type="hidden" id="action" name="action" value="" />
            <div class="tab-content content-box col-xs-12 __mb">
              <div class="table-responsive">
                <table class="table table-striped">
                  <tr>
                    <td colspan="2"><strong><?=gettext('Reporting Database Options');?></strong></td>
                  </tr>
                  <tr>
                    <td width="22%"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Round-Robin-Database");?></td>
                    <td>
                      <input name="rrdenable" type="checkbox" id="rrdenable" value="yes" <?=!empty($pconfig['rrdenable']) ? "checked=\"checked\"" : ""?> onclick="enable_change(false)" />
                      &nbsp;<strong><?=gettext("Enables the RRD graphing backend.");?></strong>
                    </td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>
                      <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
                      <input type="button" name="ResetRRD" id="ResetRRD" class="btn btn-default" value="<?=gettext("Reset RRD Data");?>" />
                    </td>
                  </tr>
                  <tr>
                    <td colspan="2">
                      <p>
                        <strong><span class="text-danger"><?=gettext("Note:");?></span></strong><br />
                            <?=gettext("Graphs will not be allowed to be recreated within a 1 minute interval, please " .
                            "take this into account after changing the style.");?>
                      </p>
                    </td>
                  </tr>
                </table>
              </div>
            </div>
             <div class="tab-content content-box col-xs-12 __mb">
              <div class="table-responsive">
                <table class="table table-striped">
                  <tr>
                    <td width="22%"><strong><?=gettext("Local Logging Options");?></strong></td>
                    <td  width="78%" align="right">
                      <small><?=gettext("full help"); ?> </small>
                      <i class="fa fa-toggle-off text-danger"  style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
                    </td>
                  </tr>
                  <tr>
                    <td><a id="help_for_reverse" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Reverse Display') ?></td>
                    <td>
                      <input name="reverse" type="checkbox" id="reverse" value="yes" <?=!empty($pconfig['reverse']) ? "checked=\"checked\"" : ""; ?> />
                      <div class="hidden" for="help_for_reverse">
                        <?=gettext("Show log entries in reverse order (newest entries on top)");?>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td><a id="help_for_nentries" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('GUI Log Entries to Display') ?></td>
                    <td>
                      <input name="nentries" type="text" value="<?=$pconfig['nentries'];?>" /><br />
                      <div class="hidden" for="help_for_nentries">
                        <?=gettext("Hint: This is only the number of log entries displayed in the GUI. It does not affect how many entries are contained in the actual log files.") ?>
                      </div>
                      </td>
                  </tr>
                  <tr>
                    <td><a id="help_for_logfilesize" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Log File Size (Bytes)') ?></td>
                    <td>
                      <input name="logfilesize" type="text" value="<?=$pconfig['logfilesize'];?>" />
                      <div class="hidden" for="help_for_logfilesize">
                        <?=gettext("Logs are held in constant-size circular log files. This field controls how large each log file is, and thus how many entries may exist inside the log. By default this is approximately 500KB per log file, and there are nearly 20 such log files.") ?>
                        <br /><br />
                        <?=gettext("NOTE: Log sizes are changed the next time a log file is cleared or deleted. To immediately increase the size of the log files, you must first save the options to set the size, then clear all logs using the \"Reset Log Files\" option farther down this page. "); ?>
                        <?=gettext("Be aware that increasing this value increases every log file size, so disk usage will increase significantly."); ?>
                        <?=gettext("Disk space currently used by log files: ") ?><?= exec("/usr/bin/du -sh /var/log | /usr/bin/awk '{print $1;}'"); ?>.
                        <?=gettext("Remaining disk space for log files: ") ?><?= exec("/bin/df -h /var/log | /usr/bin/awk '{print $4;}'"); ?>.
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td><a id="help_for_logdefaultblock" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Log Firewall Default Blocks') ?></td>
                    <td>
                      <input name="logdefaultblock" type="checkbox" value="yes" <?=!empty($pconfig['logdefaultblock']) ? "checked=\"checked\"" : ""; ?> />
                      <strong><?=gettext("Log packets matched from the default block rules put in the ruleset");?></strong><br />
                      <div class="hidden" for="help_for_logdefaultblock">
                        <?=gettext("Hint: packets that are blocked by the implicit default block rule will not be logged if you uncheck this option. Per-rule logging options are still respected.");?>
                      </div>
                      <input name="logdefaultpass" type="checkbox" id="logdefaultpass" value="yes" <?=!empty($pconfig['logdefaultpass']) ? "checked=\"checked\"" :""; ?> />
                      <strong><?=gettext("Log packets matched from the default pass rules put in the ruleset");?></strong><br />
                      <div class="hidden" for="help_for_logdefaultblock">
                        <?=gettext("Hint: packets that are allowed by the implicit default pass rule will be logged if you check this option. Per-rule logging options are still respected.");?>
                      </div>
                      <input name="logbogons" type="checkbox" id="logbogons" value="yes" <?=!empty($pconfig['logbogons']) ? "checked=\"checked\"" : ""; ?> />
                      <strong><?=gettext("Log packets blocked by 'Block Bogon Networks' rules");?></strong><br />
                      <input name="logprivatenets" type="checkbox" id="logprivatenets" value="yes" <?php if ($pconfig['logprivatenets']) echo "checked=\"checked\""; ?> />
                      <strong><?=gettext("Log packets blocked by 'Block Private Networks' rules");?></strong><br />
                    </td>
                  </tr>
                  <tr>
                    <td><a id="help_for_loglighttpd" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Web Server Log') ?></td>
                    <td>
                      <input name="loglighttpd" type="checkbox" id="loglighttpd" value="yes" <?=!empty($pconfig['loglighttpd']) ? "checked=\"checked\"" :""; ?> />
                      <strong><?=gettext("Log errors from the web server process.");?></strong><br />
                      <div class="hidden" for="help_for_loglighttpd">
                        <?=gettext("Hint: If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the main system log.");?></td>
                      </div>
                  </tr>
                  <tr>
                      <td><a id="help_for_filterdescriptions" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Filter descriptions') ?></td>
                      <td>
                        <select name="filterdescriptions" id="filterdescriptions" class="form-control">
                          <option value="0"<?=!isset($pconfig['filterdescriptions'])?" selected=\"selected\"":""?>><?=gettext('Omit descriptions') ?></option>
                          <option value="1"<?=($pconfig['filterdescriptions'])==="1"?" selected=\"selected\"":""?>><?=gettext('Display as column') ?></option>
                          <option value="2"<?=($pconfig['filterdescriptions'])==="2"?" selected=\"selected\"":""?>><?=gettext('Display as second row') ?></option>
                        </select>
                        <div class="hidden" for="help_for_filterdescriptions">
                          <strong><?=gettext("Show the applied rule description below or in the firewall log rows.");?></strong>
                          <br />
                          <?=gettext("Displaying rule descriptions for all lines in the log might affect performance with large rule sets.");?>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <td><i class="fa fa-info-circle text-muted"></i>  <?=gettext('Local Logging') ?></td>
                      <td> <input name="disablelocallogging" type="checkbox" id="disablelocallogging" value="yes" <?=!empty($pconfig['disablelocallogging']) ? "checked=\"checked\"" :""; ?> onclick="enable_change(false)" />
                      <strong><?=gettext("Disable writing log files to the local disk");?></strong></td>
                    </tr>
                    <tr>
                      <td><a id="help_for_resetlogs" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Reset Logs') ?></td>
                      <td>
                        <input name="resetlogs" id="resetlogs" type="submit" class="btn btn-default" value="<?=gettext("Reset Log Files"); ?>"/>
                        <div class="hidden" for="help_for_resetlogs">
                          <?= gettext("Note: Clears all local log files and reinitializes them as empty logs. This also restarts the DHCP daemon. Use the Save button first if you have made any setting changes."); ?>
                        </div>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>

              <div class="tab-content content-box col-xs-12 __mb">
                <div class="table-responsive">
                  <table class="table table-striped">
                    <tr>
                      <td width="22%"><strong><?=gettext("Remote Logging Options");?></strong></td>
                      <td  width="78%" align="right">
                        <small><?=gettext("full help"); ?> </small>
                        <i class="fa fa-toggle-off text-danger"  style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
                      </td>
                    </tr>
                    <tr>
                      <td><a id="help_for_sourceip" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Source Address"); ?></td>
                      <td>
                        <select name="sourceip"  class="form-control">
                          <option value=""><?=gettext('Default (any)') ?></option>
<?php
                          foreach (get_possible_traffic_source_addresses(false) as $sip):?>
                          <option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>>
                            <?=htmlspecialchars($sip['name']);?>
                          </option>
<?php
                          endforeach; ?>
                        </select>
                        <div class="hidden" for="help_for_sourceip">
                          <?= gettext("This option will allow the logging daemon to bind to a single IP address, rather than all IP addresses."); ?>
                          <?= gettext("If you pick a single IP, remote syslog severs must all be of that IP type. If you wish to mix IPv4 and IPv6 remote syslog servers, you must bind to all interfaces."); ?>
                          <br /><br />
                          <?= gettext("NOTE: If an IP address cannot be located on the chosen interface, the daemon will bind to all addresses."); ?>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <td><a id="help_for_ipproto" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IP Protocol"); ?></td>
                      <td>
                        <select name="ipproto" class="form-control">
                          <option value="ipv4" <?=$ipproto == "ipv4" ? 'selected="selected"' : "";?>><?=gettext("IPv4");?></option>
                          <option value="ipv6" <?=$ipproto == "ipv6" ? 'selected="selected"' : "";?>><?=gettext("IPv6");?></option>
                        </select>
                        <div class="hidden" for="help_for_ipproto">
                          <?= gettext("This option is only used when a non-default address is chosen as the source above. This option only expresses a preference; If an IP address of the selected type is not found on the chosen interface, the other type will be tried."); ?>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Enable Remote Logging");?></td>
                      <td>
                        <input name="enable" type="checkbox" id="enable" value="yes" <?= !empty($pconfig['enable']) ? "checked=\"checked\"" :""; ?> onclick="enable_change(false)" />
                        <strong><?=gettext("Send log messages to remote syslog server");?></strong>
                      </td>
                    </tr>
                    <tr>
                      <td><a id="help_for_remoteserver" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Remote Syslog Servers");?></td>
                      <td>
                        <table class="table table-condensed">
                          <tr>
                            <td><?=gettext("Server") . " 1";?></td>
                            <td><input name="remoteserver" id="remoteserver" type="text" class="form-control host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>" /></td>
                          </tr>
                          <tr>
                            <td><?=gettext("Server") . " 2";?></td>
                            <td><input name="remoteserver2" id="remoteserver2" type="text" class="form-control host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver2']);?>" /></td>
                          </tr>
                          <tr>
                            <td><?=gettext("Server") . " 3";?></td>
                            <td><input name="remoteserver3" id="remoteserver3" type="text" class="form-control host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver3']);?>" /></td>
                          </tr>
                        </table>
                        <div class="hidden" for="help_for_remoteserver">
                          <?=gettext("IP addresses of remote syslog servers, or an IP:port.");?>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Remote Syslog Contents");?></td>
                      <td>
                        <input name="logall" id="logall" type="checkbox" value="yes" <?=!empty($pconfig['logall']) ? "checked=\"checked\"" : ""; ?> onclick="check_everything();" />
                        <?=gettext("Everything");?><br /><br />
                        <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?=!empty($pconfig['system']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("System events");?><br />
                        <input name="filter" id="filter" type="checkbox" value="yes" <?=!empty($pconfig['filter']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("Firewall events");?><br />
                        <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?=!empty($pconfig['dhcp']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("DHCP service events");?><br />
                        <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?=!empty($pconfig['portalauth']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("Portal Auth events");?><br />
                        <input name="vpn" id="vpn" type="checkbox" value="yes" <?=!empty($pconfig['vpn']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("VPN (PPTP, IPsec, OpenVPN) events");?><br />
                        <input name="apinger" id="apinger" type="checkbox" value="yes" <?=!empty($pconfig['apinger']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("Gateway Monitor events");?><br />
                        <input name="relayd" id="relayd" type="checkbox" value="yes" <?=!empty($pconfig['relayd']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("Server Load Balancer events");?><br />
                        <input name="hostapd" id="hostapd" type="checkbox" value="yes" <?=!empty($pconfig['hostapd']) ? "checked=\"checked\"" : ""; ?> />
                        <?=gettext("Wireless events");?><br />
                      </td>
                    </tr>
                    <tr>
                      <td></td>
                      <td> <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
                      </td>
                    </tr>
                    <tr>
                      <td  colspan="2"><strong><span class="text-danger"><?=gettext("Note:")?></span></strong><br />
                      <?=gettext("syslog sends UDP datagrams to port 514 on the specified " .
                      "remote syslog server, unless another port is specified. Be sure to set syslogd on the " .
                      "remote server to accept syslog messages from");?> <?=$g['product_name']?>.
                      </td>
                    </tr>
                  </table>
                </div>
            </div>
          </form>
        </section>
      </div>
    </div>
  </section>
582
<?php include("foot.inc"); ?>