summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/status_logs.php
blob: adf5ecccb8046b823b9de420ce8d72d7ff937650 (plain)
1
2
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
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
237
238
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
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
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
<?php
/*
	status_logs.php
*/
/* ====================================================================
 *  Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
 *
 *  Some or all of this file is based on the m0n0wall project which is
 *  Copyright (c)  2004 Manuel Kasper (BSD 2 clause)
 *
 *  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.
 *
 *  3. All advertising materials mentioning features or use of this software
 *      must display the following acknowledgment:
 *      "This product includes software developed by the pfSense Project
 *       for use in the pfSense software distribution. (http://www.pfsense.org/).
 *
 *  4. The names "pfSense" and "pfSense Project" must not be used to
 *       endorse or promote products derived from this software without
 *       prior written permission. For written permission, please contact
 *       coreteam@pfsense.org.
 *
 *  5. Products derived from this software may not be called "pfSense"
 *      nor may "pfSense" appear in their names without prior written
 *      permission of the Electric Sheep Fencing, LLC.
 *
 *  6. Redistributions of any form whatsoever must retain the following
 *      acknowledgment:
 *
 *  "This product includes software developed by the pfSense Project
 *  for use in the pfSense software distribution (http://www.pfsense.org/).
 *
 *  THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
 *  EXPRESSED 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 pfSense PROJECT OR
 *  ITS CONTRIBUTORS 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.
 *
 *  ====================================================================
 *
 */

##|+PRIV
##|*IDENT=page-diagnostics-logs-system
##|*NAME=Status: Logs: System
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
##|*MATCH=status_logs.php
##|-PRIV

require("guiconfig.inc");
require_once("filter_log.inc");

/*
Build a list of allowed log files so we can reject others to prevent the page
from acting on unauthorized files.
*/
$allowed_logs = array(
	"system" => array("name" => "General",
		    "shortcut" => ""),
	"dhcpd" => array("name" => "DHCP",
		    "shortcut" => "dhcp"),
	"portalauth" => array("name" => "Captive Portal Authentication",
		    "shortcut" => "captiveportal"),
	"ipsec" => array("name" => "IPsec",
		    "shortcut" => "ipsec"),
	"ppp" => array("name" => "PPP",
		    "shortcut" => ""),
	"relayd" => array("name" => "Load Balancer",
		    "shortcut" => "relayd"),
	"openvpn" => array("name" => "OpenVPN",
		    "shortcut" => "openvpn"),
	"ntpd" => array("name" => "NTPd",
		    "shortcut" => "ntp"),
	"gateways" => array("name" => "Gateways",
		    "shortcut" => "gateways"),
	"routing" => array("name" => "Routing",
		    "shortcut" => "routing"),
	"resolver" => array("name" => "DNS Resolver",
		    "shortcut" => "resolver"),
	"wireless" => array("name" => "Wireless",
		    "shortcut" => "wireless"),
);

// The logs to display are specified in a GET argument. Default to 'system' logs
if (!$_GET['logfile']) {
	$logfile = 'system';
} else {
	$logfile = $_GET['logfile'];
	if (!array_key_exists($logfile, $allowed_logs)) {
		/* Do not let someone attempt to load an unauthorized log. */
		$logfile = 'system';
	}
}

$system_logfile = "{$g['varlog_path']}/" . basename($logfile) . ".log";


function getGETPOSTsettingvalue($settingname, $default) {
	$settingvalue = $default;
	if ($_GET[$settingname]) {
		$settingvalue = $_GET[$settingname];
	}
	if ($_POST[$settingname]) {
		$settingvalue = $_POST[$settingname];
	}
	return $settingvalue;
}


$filtersubmit = getGETPOSTsettingvalue('filtersubmit', null);

if ($filtersubmit) {
	$filter_active = true;
	$filtertext = getGETPOSTsettingvalue('filtertext', "");
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
}

$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);

if ($filterlogentries_submit) {
	$filter_active = true;
	$filterfieldsarray = array();

	$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
	$filterfieldsarray['process'] = getGETPOSTsettingvalue('filterlogentries_process', null);
	$filterfieldsarray['pid'] = getGETPOSTsettingvalue('filterlogentries_pid', null);
	$filterfieldsarray['message'] = getGETPOSTsettingvalue('filterlogentries_message', null);
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
}


# Manage Log - Code

$specific_log = basename($logfile) . '_settings';

# All
$pconfig['cronorder'] = $config['syslog'][$specific_log]['cronorder'];
$pconfig['nentries'] = $config['syslog'][$specific_log]['nentries'];
$pconfig['logfilesize'] = $config['syslog'][$specific_log]['logfilesize'];
$pconfig['format'] = $config['syslog'][$specific_log]['format'];

# System General (main) Specific
$pconfig['loglighttpd'] = !isset($config['syslog']['nologlighttpd']);

$save_settings = getGETPOSTsettingvalue('save_settings', null);

if ($save_settings) {

	# All
	$cronorder = getGETPOSTsettingvalue('cronorder',  null);
	$nentries = getGETPOSTsettingvalue('nentries', null);
	$logfilesize = getGETPOSTsettingvalue('logfilesize', null);
	$format  = getGETPOSTsettingvalue('format',  null);

	# System General (main) Specific
	$loglighttpd  = getGETPOSTsettingvalue('loglighttpd',  null);

	unset($input_errors);
	$pconfig = $_POST;

	/* input validation */
	# All
	if (isset($nentries) && (strlen($nentries) > 0)) {
		if (!is_numeric($nentries) || ($nentries < 5) || ($nentries > 2000)) {
			$input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
		}
	}

	if (isset($logfilesize) && (strlen($logfilesize) > 0)) {
		if (!is_numeric($logfilesize) || ($logfilesize < 100000)) {
			$input_errors[] = gettext("Log file size must be numeric and greater than or equal to 100000.");
		}
	}

	if (!$input_errors) {

		# Clear out the specific log settings and leave only the applied settings to override the general logging options (global) settings.
		if (isset($config['syslog'][$specific_log])) {
			unset($config['syslog'][$specific_log]);
		}

	# All
		if ($cronorder != '') { # if not using the general logging options setting (global)
			$config['syslog'][$specific_log]['cronorder'] = $cronorder;
		}

		if (isset($nentries) && (strlen($nentries) > 0)) {
			$config['syslog'][$specific_log]['nentries'] = (int)$nentries;
		}

		if (isset($logfilesize) && (strlen($logfilesize) > 0)) {
			$config['syslog'][$specific_log]['logfilesize'] = (int)$logfilesize;
		}

		if ($format != '') { # if not using the general logging options setting (global)
			$config['syslog'][$specific_log]['format'] = $format;
		}

	# System General (main) Specific
		if ($logfile == 'system') {
			$oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
			$config['syslog']['nologlighttpd'] = $loglighttpd ? false : true;

			if ($oldnologlighttpd !== $config['syslog']['nologlighttpd']) {
				$logging_changed = $lighttpd_logging_changed = true;
			}
		}


		// If any of the logging settings were changed then backup and sync (standard write_config).  Otherwise only write config (don't backup, don't sync).
		if ($logging_changed) {
			write_config($desc = "Log Display Settings Saved: " . gettext($allowed_logs[$logfile]["name"]), $backup = true, $write_config_only = false);
			$retval = 0;
			$retval = system_syslogd_start();
		} else {
			write_config($desc = "Log Display Settings Saved (no backup, no sync): " . gettext($allowed_logs[$logfile]["name"]), $backup = false, $write_config_only = true);
		}

		$savemsg = gettext("The changes have been applied successfully.");

	# System General (main) Specific
		if ($logfile == 'system') {
			if ($lighttpd_logging_changed) {
				ob_flush();
				flush();
				log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
				send_event("service restart webgui");
				$savemsg .= "<br />" . gettext("WebGUI process is restarting.");
			}
		}
	}
}


# Formatted/Raw Display
if ($config['syslog'][$specific_log]['format'] == 'formatted') {
	$rawfilter = false;
} else if ($config['syslog'][$specific_log]['format'] == 'raw') {
	$rawfilter = true;
} else {	# Use the general logging options setting (global).
	$rawfilter = isset($config['syslog']['rawfilter']);
}


isset($config['syslog'][$specific_log]['nentries']) ? $nentries = $config['syslog'][$specific_log]['nentries'] : $nentries = $config['syslog']['nentries'];

# Override Display Quantity
if ($filterlogentries_qty) {
	$nentries = $filterlogentries_qty;
}

if (!$nentries || !is_numeric($nentries)) {
	$nentries = 50;
}

if ($_POST['clear']) {
	clear_log_file($system_logfile);
}

if ($filtertext) {
	$filtertextmeta="?filtertext=$filtertext";
}

/* Setup shortcuts if they exist */

if (!empty($allowed_logs[$logfile]["shortcut"])) {
	$shortcut_section = $allowed_logs[$logfile]["shortcut"];
}

$pgtitle = array(gettext("Status"), gettext("System logs"), gettext($allowed_logs[$logfile]["name"]));
include("head.inc");

if (!$input_errors && $savemsg) {
	print_info_box($savemsg);
	$manage_log_active = false;
}

$tab_array = array();
$tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php");
$tab_array[] = array(gettext("Firewall"), false, "status_logs_filter.php");
$tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "status_logs.php?logfile=dhcpd");
$tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "status_logs.php?logfile=portalauth");
$tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "status_logs.php?logfile=ipsec");
$tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "status_logs.php?logfile=ppp");
$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
$tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "status_logs.php?logfile=relayd");
$tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "status_logs.php?logfile=openvpn");
$tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "status_logs.php?logfile=ntpd");
$tab_array[] = array(gettext("Settings"), false, "status_logs_settings.php");
display_top_tabs($tab_array);

$tab_array = array();
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless')))	 {
	$tab_array[] = array(gettext("General"), ($logfile == 'system'), "/status_logs.php");
	$tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/status_logs.php?logfile=gateways");
	$tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/status_logs.php?logfile=routing");
	$tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/status_logs.php?logfile=resolver");
	$tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/status_logs.php?logfile=wireless");
	display_top_tabs($tab_array, false, 'nav nav-tabs');
}

if ($filter_active) {
	$filter_state = SEC_OPEN;
} else {
	$filter_state = SEC_CLOSED;
}

if (!$rawfilter) { // Advanced log filter form
	$form = new Form(false);

	$section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|$filter_state);

	$group = new Form_Group('');

	$group->add(new Form_Input(
		'filterlogentries_time',
		null,
		'text',
		$filterfieldsarray['time']
	))->setWidth(3)->setHelp('Time');

	$group->add(new Form_Input(
		'filterlogentries_process',
		null,
		'text',
		$filterfieldsarray['process']
	))->setWidth(2)->setHelp('Process');

	$group->add(new Form_Input(
		'filterlogentries_pid',
		null,
		'text',
		$filterfieldsarray['pid']
	))->setWidth(2)->setHelp('PID');

	$group->add(new Form_Input(
		'filterlogentries_qty',
		null,
		'number',
		$filterlogentries_qty,
		['placeholder' => $nentries]
	))->setWidth(2)->setHelp('Quantity');

	$section->add($group);

	$group = new Form_Group('');

	$group->add(new Form_Input(
		'filterlogentries_message',
		null,
		'text',
		$filterfieldsarray['message']
	))->setWidth(7)->setHelp('Message');

	$btnsubmit = new Form_Button(
		'filterlogentries_submit',
		' ' . gettext('Apply Filter'),
		null,
		'fa-filter'
	);
} else { // Simple log filter form
	$form = new Form(false);

	$section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state);

	$group = new Form_Group('');

	$group->add(new Form_Input(
		'filtertext',
		null,
		'text',
		$filtertext
	))->setWidth(6)->setHelp('Filter Expression');

	$group->add(new Form_Input(
		'filterlogentries_qty',
		null,
		'number',
		$filterlogentries_qty,
		['placeholder' => $nentries]
	))->setWidth(2)->setHelp('Quantity');

	$btnsubmit = new Form_Button(
		'filtersubmit',
		' ' . gettext('Apply Filter'),
		null,
		'fa-filter'
	);
}

$btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');

$group->add(new Form_StaticText(
	'',
	$btnsubmit
));

$group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . gettext('Regular expression reference') . '</a> ' . gettext('Precede with exclamation (!) to exclude match.'));
$section->add($group);
$form->add($section);
print $form;

// Now the forms are complete we can draw the log table and its controls
if (!$rawfilter) {
	if ($filterlogentries_submit) {
		$filterlog = conv_log_filter($system_logfile, $nentries, $nentries + 100, $filterfieldsarray);
	} else {
		$filterlog = conv_log_filter($system_logfile, $nentries, $nentries + 100, $filtertext);
	}
?>

<div class="panel panel-default">
	<div class="panel-heading">
		<h2 class="panel-title">
<?php
	if ((!$filtertext) && (!$filterfieldsarray)) {
		printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
	} else {
		printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
	}

	printf(" (" . gettext("Maximum %d") . ")", $nentries);
?>
		</h2>
	</div>
	<div class="panel-body">
	   <div class="table-responsive">
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
			<thead>
				<tr class="text-nowrap">
					<th><?=gettext("Time")?></th>
					<th><?=gettext("Process")?></th>
					<th><?=gettext("PID")?></th>
					<th style="width:100%"><?=gettext("Message")?></th>
				</tr>
			</thead>
			<tbody>
<?php
	foreach ($filterlog as $filterent) {
?>
				<tr class="text-nowrap">
					<td>
						<?=htmlspecialchars($filterent['time'])?>
					</td>
					<td>
						<?=htmlspecialchars($filterent['process'])?>
					</td>
					<td>
						<?=htmlspecialchars($filterent['pid'])?>
					</td>
					<td style="word-wrap:break-word; word-break:break-all; white-space:normal">
						<?=htmlspecialchars($filterent['message'])?>
					</td>
				</tr>
<?php
	} // e-o-foreach
?>
			</tbody>
		</table>
<?php
	if (count($filterlog) == 0) {
		print_info_box(gettext('No logs to display'));
	}
?>
		</div>
	</div>
</div>
<?php
} else {
?>
<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
	<div class="table table-responsive">
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
			<thead>
				<tr class="text-nowrap">
					<th><?=gettext("Time")?></th>
					<th style="width:100%"><?=gettext("Message")?></th>
				</tr>
			</thead>
			<tbody>
<?php
	if (($logfile == 'resolver') || ($logfile == 'system')) {
		$inverse = array("ppp");
	} else {
		$inverse = null;
	}

	if ($filtertext) {
		$rows = dump_clog($system_logfile, $nentries, true, array("$filtertext"), $inverse);
	} else {
		$rows = dump_clog($system_logfile, $nentries, true, array(), $inverse);
	}
?>
			</tbody>
		</table>
<?php
	if ($rows == 0) {
		print_info_box(gettext('No logs to display'));
	}
?>
	</div>
</div>
<?php
}
?>

<?php
# Manage Log - Section/Form

if ($input_errors) {
	print_input_errors($input_errors);
	$manage_log_active = true;
}

if ($manage_log_active) {
	$manage_log_state = SEC_OPEN;
} else {
	$manage_log_state = SEC_CLOSED;
}

$form = new Form(false);

$section = new Form_Section(gettext('Manage') . ' ' . gettext($allowed_logs[$logfile]["name"]) . ' ' . gettext('Log'), 'log-manager-panel', COLLAPSIBLE|$manage_log_state);

$section->addInput(new Form_StaticText(
	'',
	'These settings override the "General Logging Options" settings.'
));


# All
$group = new Form_Group('Forward/Reverse Display');

$group->add(new Form_Checkbox(
	'cronorder',
	null,
	'Forward',
	($pconfig['cronorder'] == 'forward') ? true : false,
	'forward'
))->displayAsRadio()->setHelp('(newest at bottom)');

$group->add(new Form_Checkbox(
	'cronorder',
	null,
	'Reverse',
	($pconfig['cronorder'] == 'reverse') ? true : false,
	'reverse'
))->displayAsRadio()->setHelp('(newest at top)');

$group->add(new Form_Checkbox(
	'cronorder',
	null,
	'General Logging Options Setting',
	($pconfig['cronorder'] == '') ? true : false,
	''
))->displayAsRadio();

$group->setHelp('Show log entries in forward or reverse order.');
$section->add($group);

$group = new Form_Group('GUI Log Entries');

# Use the general logging options setting (global) as placeholder.
$group->add(new Form_Input(
	'nentries',
	'GUI Log Entries',
	'number',
	$pconfig['nentries'],
	['min' => 5, 'max' => 2000, 'placeholder' => $config['syslog']['nentries']]
))->setWidth(2);

$group->setHelp('This is the number of log entries displayed in the GUI. It does not affect how many entries are contained in the log.');
$section->add($group);

$group = new Form_Group('Log file size (Bytes)');

# Use the general logging options setting (global) as placeholder.
$group->add(new Form_Input(
	'logfilesize',
	'Log file size (Bytes)',
	'number',
	$pconfig['logfilesize'],
	['min' => 100000, 'placeholder' => $config['syslog']['logfilesize'] ? $config['syslog']['logfilesize'] : "511488"]
))->setWidth(2);
$group->setHelp("The log is held in a constant-size circular log file. This field controls how large the log file is, and thus how many entries may exist inside the log. The default is approximately 500KB." .
					'<br /><br />' .
			"NOTE: The log size is changed the next time it is cleared. To immediately change the log size, first save the options to set the size, then clear the log using the \"Clear Log\" action below. ");
$section->add($group);

$group = new Form_Group('Formatted/Raw Display');

$group->add(new Form_Checkbox(
	'format',
	null,
	'Formatted',
	($pconfig['format'] == 'formatted') ? true : false,
	'formatted'
))->displayAsRadio();

$group->add(new Form_Checkbox(
	'format',
	null,
	'Raw',
	($pconfig['format'] == 'raw') ? true : false,
	'raw'
))->displayAsRadio();

$group->add(new Form_Checkbox(
	'format',
	null,
	'General Logging Options Setting',
	($pconfig['format'] == '') ? true : false,
	''
))->displayAsRadio();

$group->setHelp('Show the log entries as formatted or raw output as generated by the service. The raw output will reveal more detailed information, but it is more difficult to read.');
$section->add($group);


# System General (main) Specific
if ($logfile == 'system') {
	$section->addInput(new Form_Checkbox(
		'loglighttpd',
		'Web Server Log',
		'Log errors from the web server process',
		$pconfig['loglighttpd']
	))->setHelp('If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the system log.');
}


$group = new Form_Group('Action');

$btnsavesettings = new Form_Button(
	'save_settings',
	gettext('Save'),
	null
);

$btnsavesettings->addClass('btn-sm');

$group->add(new Form_StaticText(
	'',
	$btnsavesettings
))->setHelp('Saves changed settings.');


$btnclear = new Form_Button(
	'clear',
	' ' . gettext('Clear log'),
	null,
	'fa-trash'
);

$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');

$group->add(new Form_StaticText(
	'',
	$btnclear
))->setHelp('Clears local log file and reinitializes it as an empty log. Save any settings changes first.');

$section->add($group);
$form->add($section);
print $form;
?>

<?php include("foot.inc"); ?>
OpenPOWER on IntegriCloud