Project

General

Profile

Download (20.6 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
		if (isset($config['syslog'][$specific_log])) {
195
			unset($config['syslog'][$specific_log]);
196
		}
197

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

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

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

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

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

    
220
			if ($oldnologlighttpd !== $config['syslog']['nologlighttpd']) {
221
				$logging_changed = $lighttpd_logging_changed = true;
222
			}
223
		}
224

    
225

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

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

    
237
	# System General (main) Specific
238
		if ($logfile == 'system') {
239
			if ($lighttpd_logging_changed) {
240
				ob_flush();
241
				flush();
242
				log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
243
				send_event("service restart webgui");
244
				$savemsg .= "<br />" . gettext("WebGUI process is restarting.");
245
			}
246
		}
247
	}
248
}
249

    
250

    
251
# Formatted/Raw Display
252
if ($config['syslog'][$specific_log]['format'] == 'formatted') {
253
	$rawfilter = false;
254
} else if ($config['syslog'][$specific_log]['format'] == 'raw') {
255
	$rawfilter = true;
256
} else {	# Use the general logging options setting (global).
257
	$rawfilter = isset($config['syslog']['rawfilter']);
258
}
259

    
260

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

    
263
# Override Display Quantity
264
if ($filterlogentries_qty) {
265
	$nentries = $filterlogentries_qty;
266
}
267

    
268
if (!$nentries || !is_numeric($nentries)) {
269
	$nentries = 50;
270
}
271

    
272
if ($_POST['clear']) {
273
	clear_log_file($system_logfile);
274
}
275

    
276
if ($filtertext) {
277
	$filtertextmeta="?filtertext=$filtertext";
278
}
279

    
280
/* Setup shortcuts if they exist */
281

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

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

    
289
if (!$input_errors && $savemsg) {
290
	print_info_box($savemsg);
291
	$manage_log_active = false;
292
}
293

    
294
$tab_array = array();
295
$tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php");
296
$tab_array[] = array(gettext("Firewall"), false, "status_logs_filter.php");
297
$tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "status_logs.php?logfile=dhcpd");
298
$tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "status_logs.php?logfile=portalauth");
299
$tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "status_logs.php?logfile=ipsec");
300
$tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "status_logs.php?logfile=ppp");
301
$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
302
$tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "status_logs.php?logfile=relayd");
303
$tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "status_logs.php?logfile=openvpn");
304
$tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "status_logs.php?logfile=ntpd");
305
$tab_array[] = array(gettext("Settings"), false, "status_logs_settings.php");
306
display_top_tabs($tab_array);
307

    
308
$tab_array = array();
309
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless')))	 {
310
	$tab_array[] = array(gettext("General"), ($logfile == 'system'), "/status_logs.php");
311
	$tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/status_logs.php?logfile=gateways");
312
	$tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/status_logs.php?logfile=routing");
313
	$tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/status_logs.php?logfile=resolver");
314
	$tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/status_logs.php?logfile=wireless");
315
	display_top_tabs($tab_array, false, 'nav nav-tabs');
316
}
317

    
318
if ($filter_active) {
319
	$filter_state = SEC_OPEN;
320
} else {
321
	$filter_state = SEC_CLOSED;
322
}
323

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

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

    
329
	$group = new Form_Group('');
330

    
331
	$group->add(new Form_Input(
332
		'filterlogentries_time',
333
		null,
334
		'text',
335
		$filterfieldsarray['time']
336
	))->setWidth(3)->setHelp('Time');
337

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

    
345
	$group->add(new Form_Input(
346
		'filterlogentries_pid',
347
		null,
348
		'text',
349
		$filterfieldsarray['pid']
350
	))->setWidth(2)->setHelp('PID');
351

    
352
	$group->add(new Form_Input(
353
		'filterlogentries_qty',
354
		null,
355
		'number',
356
		$filterlogentries_qty,
357
		['placeholder' => $nentries]
358
	))->setWidth(2)->setHelp('Quantity');
359

    
360
	$section->add($group);
361

    
362
	$group = new Form_Group('');
363

    
364
	$group->add(new Form_Input(
365
		'filterlogentries_message',
366
		null,
367
		'text',
368
		$filterfieldsarray['message']
369
	))->setWidth(7)->setHelp('Message');
370

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

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

    
382
	$group = new Form_Group('');
383

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

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

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

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

    
409
$group->add(new Form_StaticText(
410
	'',
411
	$btnsubmit
412
));
413

    
414
$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.'));
415
$section->add($group);
416
$form->add($section);
417
print $form;
418

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

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

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

    
505
	if ($filtertext) {
506
		$rows = dump_clog($system_logfile, $nentries, true, array("$filtertext"), $inverse);
507
	} else {
508
		$rows = dump_clog($system_logfile, $nentries, true, array(), $inverse);
509
	}
510
?>
511
			</tbody>
512
		</table>
513
<?php
514
	if ($rows == 0) {
515
		print_info_box(gettext('No logs to display'));
516
	}
517
?>
518
	</div>
519
</div>
520
<?php
521
}
522
?>
523

    
524
<?php
525
# Manage Log - Section/Form
526

    
527
if ($input_errors) {
528
	print_input_errors($input_errors);
529
	$manage_log_active = true;
530
}
531

    
532
if ($manage_log_active) {
533
	$manage_log_state = SEC_OPEN;
534
} else {
535
	$manage_log_state = SEC_CLOSED;
536
}
537

    
538
$form = new Form(false);
539

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

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

    
547

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

    
551
$group->add(new Form_Checkbox(
552
	'cronorder',
553
	null,
554
	'Forward',
555
	($pconfig['cronorder'] == 'forward') ? true : false,
556
	'forward'
557
))->displayAsRadio()->setHelp('(newest at bottom)');
558

    
559
$group->add(new Form_Checkbox(
560
	'cronorder',
561
	null,
562
	'Reverse',
563
	($pconfig['cronorder'] == 'reverse') ? true : false,
564
	'reverse'
565
))->displayAsRadio()->setHelp('(newest at top)');
566

    
567
$group->add(new Form_Checkbox(
568
	'cronorder',
569
	null,
570
	'General Logging Options Setting',
571
	($pconfig['cronorder'] == '') ? true : false,
572
	''
573
))->displayAsRadio();
574

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

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

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

    
589
$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.');
590
$section->add($group);
591

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

    
594
# Use the general logging options setting (global) as placeholder.
595
$group->add(new Form_Input(
596
	'logfilesize',
597
	'Log file size (Bytes)',
598
	'number',
599
	$pconfig['logfilesize'],
600
	['min' => 100000, 'placeholder' => $config['syslog']['logfilesize'] ? $config['syslog']['logfilesize'] : "511488"]
601
))->setWidth(2);
602
$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." .
603
					'<br /><br />' .
604
			"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. ");
605
$section->add($group);
606

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

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

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

    
625
$group->add(new Form_Checkbox(
626
	'format',
627
	null,
628
	'General Logging Options Setting',
629
	($pconfig['format'] == '') ? true : false,
630
	''
631
))->displayAsRadio();
632

    
633
$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.');
634
$section->add($group);
635

    
636

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

    
647

    
648
$group = new Form_Group('Action');
649

    
650
$btnsavesettings = new Form_Button(
651
	'save_settings',
652
	gettext('Save'),
653
	null
654
);
655

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

    
658
$group->add(new Form_StaticText(
659
	'',
660
	$btnsavesettings
661
))->setHelp('Saves changed settings.');
662

    
663

    
664
$btnclear = new Form_Button(
665
	'clear',
666
	' ' . gettext('Clear log'),
667
	null,
668
	'fa-trash'
669
);
670

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

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

    
678
$section->add($group);
679
$form->add($section);
680
print $form;
681
?>
682

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