Project

General

Profile

Download (19.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	status_logs.php
4
*/
5
/* ====================================================================
6
 *  Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *
8
 *  Some or all of this file is based on the m0n0wall project which is
9
 *  Copyright (c)  2004 Manuel Kasper (BSD 2 clause)
10
 *
11
 *  Redistribution and use in source and binary forms, with or without modification,
12
 *  are permitted provided that the following conditions are met:
13
 *
14
 *  1. Redistributions of source code must retain the above copyright notice,
15
 *      this list of conditions and the following disclaimer.
16
 *
17
 *  2. Redistributions in binary form must reproduce the above copyright
18
 *      notice, this list of conditions and the following disclaimer in
19
 *      the documentation and/or other materials provided with the
20
 *      distribution.
21
 *
22
 *  3. All advertising materials mentioning features or use of this software
23
 *      must display the following acknowledgment:
24
 *      "This product includes software developed by the pfSense Project
25
 *       for use in the pfSense software distribution. (http://www.pfsense.org/).
26
 *
27
 *  4. The names "pfSense" and "pfSense Project" must not be used to
28
 *       endorse or promote products derived from this software without
29
 *       prior written permission. For written permission, please contact
30
 *       coreteam@pfsense.org.
31
 *
32
 *  5. Products derived from this software may not be called "pfSense"
33
 *      nor may "pfSense" appear in their names without prior written
34
 *      permission of the Electric Sheep Fencing, LLC.
35
 *
36
 *  6. Redistributions of any form whatsoever must retain the following
37
 *      acknowledgment:
38
 *
39
 *  "This product includes software developed by the pfSense Project
40
 *  for use in the pfSense software distribution (http://www.pfsense.org/).
41
 *
42
 *  THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
43
 *  EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
45
 *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
46
 *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50
 *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
 *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53
 *  OF THE POSSIBILITY OF SUCH DAMAGE.
54
 *
55
 *  ====================================================================
56
 *
57
 */
58

    
59
/*
60
	pfSense_MODULE:	system
61
*/
62

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

    
70
require("guiconfig.inc");
71
require_once("filter_log.inc");
72

    
73
/*
74
Build a list of allowed log files so we can reject others to prevent the page
75
from acting on unauthorized files.
76
*/
77
$allowed_logs = array(
78
	"system" => array("name" => "General",
79
		    "shortcut" => ""),
80
	"dhcpd" => array("name" => "DHCP",
81
		    "shortcut" => "dhcp"),
82
	"portalauth" => array("name" => "Captive Portal Authentication",
83
		    "shortcut" => "captiveportal"),
84
	"ipsec" => array("name" => "IPsec",
85
		    "shortcut" => "ipsec"),
86
	"ppp" => array("name" => "PPP",
87
		    "shortcut" => ""),
88
	"relayd" => array("name" => "Load Balancer",
89
		    "shortcut" => "relayd"),
90
	"openvpn" => array("name" => "OpenVPN",
91
		    "shortcut" => "openvpn"),
92
	"ntpd" => array("name" => "NTPd",
93
		    "shortcut" => "ntp"),
94
	"gateways" => array("name" => "Gateways",
95
		    "shortcut" => "gateways"),
96
	"routing" => array("name" => "Routing",
97
		    "shortcut" => "routing"),
98
	"resolver" => array("name" => "DNS Resolver",
99
		    "shortcut" => "resolver"),
100
	"wireless" => array("name" => "Wireless",
101
		    "shortcut" => "wireless"),
102
);
103

    
104
// The logs to display are specified in a GET argument. Default to 'system' logs
105
if (!$_GET['logfile']) {
106
	$logfile = 'system';
107
} else {
108
	$logfile = $_GET['logfile'];
109
	if (!array_key_exists($logfile, $allowed_logs)) {
110
		/* Do not let someone attempt to load an unauthorized log. */
111
		$logfile = 'system';
112
	}
113
}
114

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

    
117

    
118
function getGETPOSTsettingvalue($settingname, $default) {
119
	$settingvalue = $default;
120
	if ($_GET[$settingname]) {
121
		$settingvalue = $_GET[$settingname];
122
	}
123
	if ($_POST[$settingname]) {
124
		$settingvalue = $_POST[$settingname];
125
	}
126
	return $settingvalue;
127
}
128

    
129

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

    
132
if ($filtersubmit) {
133
	$filter_active = true;
134
	$filtertext = getGETPOSTsettingvalue('filtertext', "");
135
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
136
}
137

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

    
140
if ($filterlogentries_submit) {
141
	$filter_active = true;
142
	$filterfieldsarray = array();
143

    
144
	$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
145
	$filterfieldsarray['process'] = getGETPOSTsettingvalue('filterlogentries_process', null);
146
	$filterfieldsarray['pid'] = getGETPOSTsettingvalue('filterlogentries_pid', null);
147
	$filterfieldsarray['message'] = getGETPOSTsettingvalue('filterlogentries_message', null);
148
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
149
}
150

    
151

    
152
# Manage Log - Code
153

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

    
156
# All
157
$pconfig['cronorder'] = $config['syslog'][$specific_log]['cronorder'];
158
$pconfig['nentries'] = $config['syslog'][$specific_log]['nentries'];
159
$pconfig['logfilesize'] = $config['syslog'][$specific_log]['logfilesize'];
160
$pconfig['format'] = $config['syslog'][$specific_log]['format'];
161

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

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

    
167
if ($save_settings) {
168

    
169
	# All
170
	$cronorder = getGETPOSTsettingvalue('cronorder',  null);
171
	$nentries = getGETPOSTsettingvalue('nentries', null);
172
	$logfilesize = getGETPOSTsettingvalue('logfilesize', null);
173
	$format  = getGETPOSTsettingvalue('format',  null);
174

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

    
178
	unset($input_errors);
179
	$pconfig = $_POST;
180

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

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

    
195
	if (!$input_errors) {
196

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

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

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

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

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

    
217
	# System General (main) Specific
218
		if ($logfile == 'system') {
219
			$oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
220
			$config['syslog']['nologlighttpd'] = $loglighttpd ? false : true;
221
		}
222

    
223

    
224
		write_config($desc = "Log Display Settings Saved: " . gettext($allowed_logs[$logfile]["name"]));
225

    
226
		$retval = 0;
227
		$savemsg = get_std_save_message($retval);
228

    
229
	# System General (main) Specific
230
		if ($logfile == 'system') {
231
			if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
232
				ob_flush();
233
				flush();
234
				log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
235
				send_event("service restart webgui");
236
				$savemsg .= "<br />" . gettext("WebGUI process is restarting.");
237
			}
238
		}
239
	}
240
}
241

    
242

    
243
# Formatted/Raw Display
244
if ($config['syslog'][$specific_log]['format'] == 'formatted') {
245
	$rawfilter = false;
246
}
247
else if ($config['syslog'][$specific_log]['format'] == 'raw') {
248
	$rawfilter = true;
249
}	
250
else {	# Use the general logging options setting (global).
251
	$rawfilter = isset($config['syslog']['rawfilter']);
252
}
253

    
254

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

    
257
# Override Display Quantity
258
if ($filterlogentries_qty) {
259
	$nentries = $filterlogentries_qty;
260
}
261

    
262
if (!$nentries || !is_numeric($nentries)) {
263
	$nentries = 50;
264
}
265

    
266
if ($_POST['clear']) {
267
	clear_log_file($system_logfile);
268
}
269

    
270
if ($filtertext) {
271
	$filtertextmeta="?filtertext=$filtertext";
272
}
273

    
274
/* Setup shortcuts if they exist */
275

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

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

    
283
if (!$input_errors && $savemsg) {
284
	print_info_box($savemsg);
285
	$manage_log_active = false;
286
}
287

    
288
$tab_array = array();
289
$tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php");
290
$tab_array[] = array(gettext("Firewall"), false, "status_logs_filter.php");
291
$tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "status_logs.php?logfile=dhcpd");
292
$tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "status_logs.php?logfile=portalauth");
293
$tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "status_logs.php?logfile=ipsec");
294
$tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "status_logs.php?logfile=ppp");
295
$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
296
$tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "status_logs.php?logfile=relayd");
297
$tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "status_logs.php?logfile=openvpn");
298
$tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "status_logs.php?logfile=ntpd");
299
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
300
display_top_tabs($tab_array);
301

    
302
$tab_array = array();
303
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless')))	 {
304
	$tab_array[] = array(gettext("General"), ($logfile == 'system'), "/status_logs.php");
305
	$tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/status_logs.php?logfile=gateways");
306
	$tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/status_logs.php?logfile=routing");
307
	$tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/status_logs.php?logfile=resolver");
308
	$tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/status_logs.php?logfile=wireless");
309
	display_top_tabs($tab_array, false, 'nav nav-tabs');
310
}
311

    
312
define(SEC_OPEN, 0x00);
313
define(SEC_CLOSED, 0x04);
314

    
315
if ($filter_active)
316
	$filter_state = SEC_OPEN;
317
else
318
	$filter_state = SEC_CLOSED;
319

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

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

    
325
	$group = new Form_Group('');
326

    
327
	$group->add(new Form_Input(
328
		'filterlogentries_time',
329
		null,
330
		'text',
331
		$filterfieldsarray['time']
332
	))->setWidth(3)->setHelp('Time');
333

    
334
	$group->add(new Form_Input(
335
		'filterlogentries_process',
336
		null,
337
		'text',
338
		$filterfieldsarray['process']
339
	))->setWidth(2)->setHelp('Process');
340

    
341
	$group->add(new Form_Input(
342
		'filterlogentries_pid',
343
		null,
344
		'text',
345
		$filterfieldsarray['pid']
346
	))->setWidth(2)->setHelp('PID');
347

    
348
	$group->add(new Form_Input(
349
		'filterlogentries_qty',
350
		null,
351
		'number',
352
		$filterlogentries_qty,
353
		['placeholder' => $nentries]
354
	))->setWidth(2)->setHelp('Quantity');
355

    
356
	$section->add($group);
357

    
358
	$group = new Form_Group('');
359

    
360
	$group->add(new Form_Input(
361
		'filterlogentries_message',
362
		null,
363
		'text',
364
		$filterfieldsarray['message']
365
	))->setWidth(7)->setHelp('Message');
366

    
367
	$btnsubmit = new Form_Button(
368
		'filterlogentries_submit',
369
		' ' . gettext('Apply Filter'),
370
		null,
371
		'fa-filter'
372
	);
373
}
374
else { // Simple log filter form
375
	$form = new Form(false);
376

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

    
379
	$group = new Form_Group('');
380

    
381
	$group->add(new Form_Input(
382
		'filtertext',
383
		null,
384
		'text',
385
		$filtertext
386
	))->setWidth(6)->setHelp('Filter Expression');
387

    
388
	$group->add(new Form_Input(
389
		'filterlogentries_qty',
390
		null,
391
		'number',
392
		$filterlogentries_qty,
393
		['placeholder' => $nentries]
394
	))->setWidth(2)->setHelp('Quantity');
395

    
396
	$btnsubmit = new Form_Button(
397
		'filtersubmit',
398
		' ' . gettext('Apply Filter'),
399
		null,
400
		'fa-filter'
401
	);
402
}
403

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

    
406
$group->add(new Form_StaticText(
407
	'',
408
	$btnsubmit
409
));
410

    
411
$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.'));
412
$section->add($group);
413
$form->add($section);
414
print $form;
415

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

    
424
<div class="panel panel-default">
425
	<div class="panel-heading">
426
		<h2 class="panel-title">
427
<?php
428
	if ((!$filtertext) && (!$filterfieldsarray))
429
		printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
430
	else
431
		printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
432

    
433
	printf(" (" . gettext("Maximum %d") . ")", $nentries);
434
?>
435
		</h2>
436
	</div>
437
	<div class="panel-body">
438
	   <div class="table-responsive">
439
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
440
			<thead>
441
				<tr>
442
					<th><?=gettext("Time")?></th>
443
					<th><?=gettext("Process")?></th>
444
					<th><?=gettext("PID")?></th>
445
					<th style="width:100%"><?=gettext("Message")?></th>
446
				</tr>
447
			</thead>
448
			<tbody>
449
<?php
450
	foreach ($filterlog as $filterent) {
451
?>
452
				<tr>
453
					<td style="white-space:nowrap;">
454
						<?=htmlspecialchars($filterent['time'])?>
455
					</td>
456
					<td style="white-space:nowrap;">
457
						<?=htmlspecialchars($filterent['process'])?>
458
					</td>
459
					<td style="white-space:nowrap;">
460
						<?=htmlspecialchars($filterent['pid'])?>
461
					</td>
462
					<td style="word-wrap:break-word; word-break:break-all; white-space:normal">
463
						<?=htmlspecialchars($filterent['message'])?>
464
					</td>
465
				</tr>
466
<?php
467
	} // e-o-foreach
468
?>
469
			</tbody>
470
		</table>
471
<?php
472
	if (count($filterlog) == 0)
473
		print_info_box(gettext('No logs to display'));
474
?>
475
		</div>
476
	</div>
477
</div>
478
<?php
479
}
480
else
481
{
482
?>
483
<div class="panel panel-default">
484
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
485
	<div class="table table-responsive">
486
		<table class="table table-striped table-hover">
487
			<thead>
488
				<tr>
489
					<th><?=gettext("Time")?></th>
490
					<th style="width:100%"><?=gettext("Message")?></th>
491
				</tr>
492
			</thead>
493
			<tbody>
494
<?php
495
	if (($logfile == 'resolver') || ($logfile == 'system'))
496
		$inverse = array("ppp");
497
	else
498
		$inverse = null;
499

    
500
	if ($filtertext)
501
		$rows = dump_clog($system_logfile, $nentries, true, array("$filtertext"), $inverse);
502
	else
503
		$rows = dump_clog($system_logfile, $nentries, true, array(), $inverse);
504
?>
505
			</tbody>
506
		</table>
507
<?php
508
	if ($rows == 0)
509
		print_info_box(gettext('No logs to display'));
510
?>
511
	</div>
512
</div>
513
<?php
514
}
515
?>
516

    
517
<?php
518
# Manage Log - Section/Form
519

    
520
if ($input_errors) {
521
	print_input_errors($input_errors);
522
	$manage_log_active = true;
523
}
524

    
525
if ($manage_log_active)
526
	$manage_log_state = SEC_OPEN;
527
else
528
	$manage_log_state = SEC_CLOSED;
529

    
530
$form = new Form(false);
531

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

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

    
539

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

    
543
$group->add(new Form_Checkbox(
544
	'cronorder',
545
	null,
546
	'Forward',
547
	($pconfig['cronorder'] == 'forward') ? true : false,
548
	'forward'
549
))->displayAsRadio();
550

    
551
$group->add(new Form_Checkbox(
552
	'cronorder',
553
	null,
554
	'Reverse',
555
	($pconfig['cronorder'] == 'reverse') ? true : false,
556
	'reverse'
557
))->displayAsRadio();
558

    
559
$group->add(new Form_Checkbox(
560
	'cronorder',
561
	null,
562
	'General Logging Options Setting',
563
	($pconfig['cronorder'] == '') ? true : false,
564
	''
565
))->displayAsRadio();
566

    
567
$group->setHelp('Show log entries in forward (newest at bottom) or reverse (newest at top) order.');
568
$section->add($group);
569

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

    
572
# Use the general logging options setting (global) as placeholder.
573
$group->add(new Form_Input(
574
	'nentries',
575
	'GUI Log Entries',
576
	'number',
577
	$pconfig['nentries'],
578
	['placeholder' => $config['syslog']['nentries']]
579
))->setWidth(2);
580

    
581
$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.');
582
$section->add($group);
583

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

    
586
# Use the general logging options setting (global) as placeholder.
587
$group->add(new Form_Input(
588
	'logfilesize',
589
	'Log file size (Bytes)',
590
	'number',
591
	$pconfig['logfilesize'],
592
	['placeholder' => $config['syslog']['logfilesize'] ? $config['syslog']['logfilesize'] : "511488"]
593
))->setWidth(2);
594
$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." .
595
					'<br /><br />' .
596
			"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. ");
597
$section->add($group);
598

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

    
601
$group->add(new Form_Checkbox(
602
	'format',
603
	null,
604
	'Formatted',
605
	($pconfig['format'] == 'formatted') ? true : false,
606
	'formatted'
607
))->displayAsRadio();
608

    
609
$group->add(new Form_Checkbox(
610
	'format',
611
	null,
612
	'Raw',
613
	($pconfig['format'] == 'raw') ? true : false,
614
	'raw'
615
))->displayAsRadio();
616

    
617
$group->add(new Form_Checkbox(
618
	'format',
619
	null,
620
	'General Logging Options Setting',
621
	($pconfig['format'] == '') ? true : false,
622
	''
623
))->displayAsRadio();
624

    
625
$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.');
626
$section->add($group);
627

    
628

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

    
639

    
640
$group = new Form_Group('Action');
641

    
642
$btnsavesettings = new Form_Button(
643
	'save_settings',
644
	gettext('Save'),
645
	null
646
);
647

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

    
650
$group->add(new Form_StaticText(
651
	'',
652
	$btnsavesettings
653
))->setHelp('Saves changed settings.');
654

    
655

    
656
$btnclear = new Form_Button(
657
	'clear',
658
	' ' . gettext('Clear log'),
659
	null,
660
	'fa-trash'
661
);
662

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

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

    
670
$section->add($group);
671
$form->add($section);
672
print $form;
673
?>
674

    
675
<?php include("foot.inc"); ?>
(170-170/228)