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, "status_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
if ($filter_active)
313
	$filter_state = SEC_OPEN;
314
else
315
	$filter_state = SEC_CLOSED;
316

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

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

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

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

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

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

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

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

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

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

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

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

    
376
	$group = new Form_Group('');
377

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

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

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

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

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

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

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

    
421
<div class="panel panel-default">
422
	<div class="panel-heading">
423
		<h2 class="panel-title">
424
<?php
425
	if ((!$filtertext) && (!$filterfieldsarray))
426
		printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
427
	else
428
		printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
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 style="white-space:nowrap;">
439
					<th><?=gettext("Time")?></th>
440
					<th><?=gettext("Process")?></th>
441
					<th><?=gettext("PID")?></th>
442
					<th style="width:100%"><?=gettext("Message")?></th>
443
				</tr>
444
			</thead>
445
			<tbody>
446
<?php
447
	foreach ($filterlog as $filterent) {
448
?>
449
				<tr style="white-space:nowrap;">
450
					<td>
451
						<?=htmlspecialchars($filterent['time'])?>
452
					</td>
453
					<td>
454
						<?=htmlspecialchars($filterent['process'])?>
455
					</td>
456
					<td>
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
		</div>
473
	</div>
474
</div>
475
<?php
476
}
477
else
478
{
479
?>
480
<div class="panel panel-default">
481
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
482
	<div class="table table-responsive">
483
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
484
			<thead>
485
				<tr style="white-space:nowrap;">
486
					<th><?=gettext("Time")?></th>
487
					<th style="width:100%"><?=gettext("Message")?></th>
488
				</tr>
489
			</thead>
490
			<tbody>
491
<?php
492
	if (($logfile == 'resolver') || ($logfile == 'system'))
493
		$inverse = array("ppp");
494
	else
495
		$inverse = null;
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
			</tbody>
503
		</table>
504
<?php
505
	if ($rows == 0)
506
		print_info_box(gettext('No logs to display'));
507
?>
508
	</div>
509
</div>
510
<?php
511
}
512
?>
513

    
514
<?php
515
# Manage Log - Section/Form
516

    
517
if ($input_errors) {
518
	print_input_errors($input_errors);
519
	$manage_log_active = true;
520
}
521

    
522
if ($manage_log_active)
523
	$manage_log_state = SEC_OPEN;
524
else
525
	$manage_log_state = SEC_CLOSED;
526

    
527
$form = new Form(false);
528

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

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

    
536

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

    
540
$group->add(new Form_Checkbox(
541
	'cronorder',
542
	null,
543
	'Forward',
544
	($pconfig['cronorder'] == 'forward') ? true : false,
545
	'forward'
546
))->displayAsRadio()->setHelp('(newest at bottom)');
547

    
548
$group->add(new Form_Checkbox(
549
	'cronorder',
550
	null,
551
	'Reverse',
552
	($pconfig['cronorder'] == 'reverse') ? true : false,
553
	'reverse'
554
))->displayAsRadio()->setHelp('(newest at top)');
555

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

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

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

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

    
578
$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.');
579
$section->add($group);
580

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

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

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

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

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

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

    
622
$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.');
623
$section->add($group);
624

    
625

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

    
636

    
637
$group = new Form_Group('Action');
638

    
639
$btnsavesettings = new Form_Button(
640
	'save_settings',
641
	gettext('Save'),
642
	null
643
);
644

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

    
647
$group->add(new Form_StaticText(
648
	'',
649
	$btnsavesettings
650
))->setHelp('Saves changed settings.');
651

    
652

    
653
$btnclear = new Form_Button(
654
	'clear',
655
	' ' . gettext('Clear log'),
656
	null,
657
	'fa-trash'
658
);
659

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

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

    
667
$section->add($group);
668
$form->add($section);
669
print $form;
670
?>
671

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