Project

General

Profile

Download (20 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
##|+PRIV
60
##|*IDENT=page-diagnostics-logs-system
61
##|*NAME=Status: Logs: System
62
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
63
##|*MATCH=status_logs.php
64
##|-PRIV
65

    
66
require("guiconfig.inc");
67
require_once("filter_log.inc");
68

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

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

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

    
113

    
114
function getGETPOSTsettingvalue($settingname, $default) {
115
	$settingvalue = $default;
116
	if ($_GET[$settingname]) {
117
		$settingvalue = $_GET[$settingname];
118
	}
119
	if ($_POST[$settingname]) {
120
		$settingvalue = $_POST[$settingname];
121
	}
122
	return $settingvalue;
123
}
124

    
125

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

    
128
if ($filtersubmit) {
129
	$filter_active = true;
130
	$filtertext = getGETPOSTsettingvalue('filtertext', "");
131
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
132
}
133

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

    
136
if ($filterlogentries_submit) {
137
	$filter_active = true;
138
	$filterfieldsarray = array();
139

    
140
	$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
141
	$filterfieldsarray['process'] = getGETPOSTsettingvalue('filterlogentries_process', null);
142
	$filterfieldsarray['pid'] = getGETPOSTsettingvalue('filterlogentries_pid', null);
143
	$filterfieldsarray['message'] = getGETPOSTsettingvalue('filterlogentries_message', null);
144
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
145
}
146

    
147

    
148
# Manage Log - Code
149

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

    
152
# All
153
$pconfig['cronorder'] = $config['syslog'][$specific_log]['cronorder'];
154
$pconfig['nentries'] = $config['syslog'][$specific_log]['nentries'];
155
$pconfig['logfilesize'] = $config['syslog'][$specific_log]['logfilesize'];
156
$pconfig['format'] = $config['syslog'][$specific_log]['format'];
157

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

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

    
163
if ($save_settings) {
164

    
165
	# All
166
	$cronorder = getGETPOSTsettingvalue('cronorder',  null);
167
	$nentries = getGETPOSTsettingvalue('nentries', null);
168
	$logfilesize = getGETPOSTsettingvalue('logfilesize', null);
169
	$format  = getGETPOSTsettingvalue('format',  null);
170

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

    
174
	unset($input_errors);
175
	$pconfig = $_POST;
176

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

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

    
191
	if (!$input_errors) {
192

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

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

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

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

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

    
213
	# System General (main) Specific
214
		if ($logfile == 'system') {
215
			$oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
216
			$config['syslog']['nologlighttpd'] = $loglighttpd ? false : true;
217
		}
218

    
219

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

    
222
		$retval = 0;
223
		$savemsg = get_std_save_message($retval);
224

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

    
238

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

    
248

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

    
251
# Override Display Quantity
252
if ($filterlogentries_qty) {
253
	$nentries = $filterlogentries_qty;
254
}
255

    
256
if (!$nentries || !is_numeric($nentries)) {
257
	$nentries = 50;
258
}
259

    
260
if ($_POST['clear']) {
261
	clear_log_file($system_logfile);
262
}
263

    
264
if ($filtertext) {
265
	$filtertextmeta="?filtertext=$filtertext";
266
}
267

    
268
/* Setup shortcuts if they exist */
269

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

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

    
277
if (!$input_errors && $savemsg) {
278
	print_info_box($savemsg);
279
	$manage_log_active = false;
280
}
281

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

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

    
306
if ($filter_active) {
307
	$filter_state = SEC_OPEN;
308
} else {
309
	$filter_state = SEC_CLOSED;
310
}
311

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

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

    
317
	$group = new Form_Group('');
318

    
319
	$group->add(new Form_Input(
320
		'filterlogentries_time',
321
		null,
322
		'text',
323
		$filterfieldsarray['time']
324
	))->setWidth(3)->setHelp('Time');
325

    
326
	$group->add(new Form_Input(
327
		'filterlogentries_process',
328
		null,
329
		'text',
330
		$filterfieldsarray['process']
331
	))->setWidth(2)->setHelp('Process');
332

    
333
	$group->add(new Form_Input(
334
		'filterlogentries_pid',
335
		null,
336
		'text',
337
		$filterfieldsarray['pid']
338
	))->setWidth(2)->setHelp('PID');
339

    
340
	$group->add(new Form_Input(
341
		'filterlogentries_qty',
342
		null,
343
		'number',
344
		$filterlogentries_qty,
345
		['placeholder' => $nentries]
346
	))->setWidth(2)->setHelp('Quantity');
347

    
348
	$section->add($group);
349

    
350
	$group = new Form_Group('');
351

    
352
	$group->add(new Form_Input(
353
		'filterlogentries_message',
354
		null,
355
		'text',
356
		$filterfieldsarray['message']
357
	))->setWidth(7)->setHelp('Message');
358

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

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

    
370
	$group = new Form_Group('');
371

    
372
	$group->add(new Form_Input(
373
		'filtertext',
374
		null,
375
		'text',
376
		$filtertext
377
	))->setWidth(6)->setHelp('Filter Expression');
378

    
379
	$group->add(new Form_Input(
380
		'filterlogentries_qty',
381
		null,
382
		'number',
383
		$filterlogentries_qty,
384
		['placeholder' => $nentries]
385
	))->setWidth(2)->setHelp('Quantity');
386

    
387
	$btnsubmit = new Form_Button(
388
		'filtersubmit',
389
		' ' . gettext('Apply Filter'),
390
		null,
391
		'fa-filter'
392
	);
393
}
394

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

    
397
$group->add(new Form_StaticText(
398
	'',
399
	$btnsubmit
400
));
401

    
402
$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.'));
403
$section->add($group);
404
$form->add($section);
405
print $form;
406

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

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

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

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

    
512
<?php
513
# Manage Log - Section/Form
514

    
515
if ($input_errors) {
516
	print_input_errors($input_errors);
517
	$manage_log_active = true;
518
}
519

    
520
if ($manage_log_active) {
521
	$manage_log_state = SEC_OPEN;
522
} else {
523
	$manage_log_state = SEC_CLOSED;
524
}
525

    
526
$form = new Form(false);
527

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

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

    
535

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
624

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

    
635

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

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

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

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

    
651

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

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

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

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

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