Project

General

Profile

Download (20.5 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
			if ($oldnologlighttpd !== $config['syslog']['nologlighttpd']) {
219
				$logging_changed = $lighttpd_logging_changed = true;
220
			}
221
		}
222

    
223

    
224
		// 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).
225
		if ($logging_changed) {
226
			write_config($desc = "Log Display Settings Saved: " . gettext($allowed_logs[$logfile]["name"]), $backup = true, $write_config_only = false);
227
			$retval = 0;
228
			$retval = system_syslogd_start();
229
		} else {
230
			write_config($desc = "Log Display Settings Saved (no backup, no sync): " . gettext($allowed_logs[$logfile]["name"]), $backup = false, $write_config_only = true);
231
		}
232

    
233
		$savemsg = gettext("The changes have been applied successfully.");
234

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

    
248

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

    
258

    
259
isset($config['syslog'][$specific_log]['nentries']) ? $nentries = $config['syslog'][$specific_log]['nentries'] : $nentries = $config['syslog']['nentries'];
260

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

    
266
if (!$nentries || !is_numeric($nentries)) {
267
	$nentries = 50;
268
}
269

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

    
274
if ($filtertext) {
275
	$filtertextmeta="?filtertext=$filtertext";
276
}
277

    
278
/* Setup shortcuts if they exist */
279

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

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

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

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

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

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

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

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

    
327
	$group = new Form_Group('');
328

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

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

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

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

    
358
	$section->add($group);
359

    
360
	$group = new Form_Group('');
361

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
522
<?php
523
# Manage Log - Section/Form
524

    
525
if ($input_errors) {
526
	print_input_errors($input_errors);
527
	$manage_log_active = true;
528
}
529

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

    
536
$form = new Form(false);
537

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

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

    
545

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

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

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

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

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

    
576
$group = new Form_Group('GUI Log Entries');
577

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

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

    
590
$group = new Form_Group('Log file size (Bytes)');
591

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

    
605
$group = new Form_Group('Formatted/Raw Display');
606

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

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

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

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

    
634

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

    
645

    
646
$group = new Form_Group('Action');
647

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

    
654
$btnsavesettings->addClass('btn-sm');
655

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

    
661

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

    
669
$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
670

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

    
676
$section->add($group);
677
$form->add($section);
678
print $form;
679
?>
680

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