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
} else if ($config['syslog'][$specific_log]['format'] == 'raw') {
247
	$rawfilter = true;
248
} else {	# Use the general logging options setting (global).
249
	$rawfilter = isset($config['syslog']['rawfilter']);
250
}
251

    
252

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

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

    
260
if (!$nentries || !is_numeric($nentries)) {
261
	$nentries = 50;
262
}
263

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

    
268
if ($filtertext) {
269
	$filtertextmeta="?filtertext=$filtertext";
270
}
271

    
272
/* Setup shortcuts if they exist */
273

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

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

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

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

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

    
310
if ($filter_active) {
311
	$filter_state = SEC_OPEN;
312
} else {
313
	$filter_state = SEC_CLOSED;
314
}
315

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

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

    
321
	$group = new Form_Group('');
322

    
323
	$group->add(new Form_Input(
324
		'filterlogentries_time',
325
		null,
326
		'text',
327
		$filterfieldsarray['time']
328
	))->setWidth(3)->setHelp('Time');
329

    
330
	$group->add(new Form_Input(
331
		'filterlogentries_process',
332
		null,
333
		'text',
334
		$filterfieldsarray['process']
335
	))->setWidth(2)->setHelp('Process');
336

    
337
	$group->add(new Form_Input(
338
		'filterlogentries_pid',
339
		null,
340
		'text',
341
		$filterfieldsarray['pid']
342
	))->setWidth(2)->setHelp('PID');
343

    
344
	$group->add(new Form_Input(
345
		'filterlogentries_qty',
346
		null,
347
		'number',
348
		$filterlogentries_qty,
349
		['placeholder' => $nentries]
350
	))->setWidth(2)->setHelp('Quantity');
351

    
352
	$section->add($group);
353

    
354
	$group = new Form_Group('');
355

    
356
	$group->add(new Form_Input(
357
		'filterlogentries_message',
358
		null,
359
		'text',
360
		$filterfieldsarray['message']
361
	))->setWidth(7)->setHelp('Message');
362

    
363
	$btnsubmit = new Form_Button(
364
		'filterlogentries_submit',
365
		' ' . gettext('Apply Filter'),
366
		null,
367
		'fa-filter'
368
	);
369
} else { // Simple log filter form
370
	$form = new Form(false);
371

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

    
374
	$group = new Form_Group('');
375

    
376
	$group->add(new Form_Input(
377
		'filtertext',
378
		null,
379
		'text',
380
		$filtertext
381
	))->setWidth(6)->setHelp('Filter Expression');
382

    
383
	$group->add(new Form_Input(
384
		'filterlogentries_qty',
385
		null,
386
		'number',
387
		$filterlogentries_qty,
388
		['placeholder' => $nentries]
389
	))->setWidth(2)->setHelp('Quantity');
390

    
391
	$btnsubmit = new Form_Button(
392
		'filtersubmit',
393
		' ' . gettext('Apply Filter'),
394
		null,
395
		'fa-filter'
396
	);
397
}
398

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

    
401
$group->add(new Form_StaticText(
402
	'',
403
	$btnsubmit
404
));
405

    
406
$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.'));
407
$section->add($group);
408
$form->add($section);
409
print $form;
410

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

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

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

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

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

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

    
524
if ($manage_log_active) {
525
	$manage_log_state = SEC_OPEN;
526
} else {
527
	$manage_log_state = SEC_CLOSED;
528
}
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()->setHelp('(newest at bottom)');
550

    
551
$group->add(new Form_Checkbox(
552
	'cronorder',
553
	null,
554
	'Reverse',
555
	($pconfig['cronorder'] == 'reverse') ? true : false,
556
	'reverse'
557
))->displayAsRadio()->setHelp('(newest at top)');
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 or reverse 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)