Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
b2af67a9
Commit
b2af67a9
authored
Sep 22, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logs: improve all things logging for #397
parent
a3e5de62
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
189 additions
and
147 deletions
+189
-147
system.inc
src/etc/inc/system.inc
+6
-12
rc
src/etc/rc
+2
-7
diag_logs.php
src/www/diag_logs.php
+1
-1
diag_logs_auth.php
src/www/diag_logs_auth.php
+1
-1
diag_logs_dhcp.php
src/www/diag_logs_dhcp.php
+1
-1
diag_logs_filter.php
src/www/diag_logs_filter.php
+1
-3
diag_logs_filter_dynamic.php
src/www/diag_logs_filter_dynamic.php
+1
-1
diag_logs_filter_summary.php
src/www/diag_logs_filter_summary.php
+1
-0
diag_logs_gateways.php
src/www/diag_logs_gateways.php
+1
-1
diag_logs_ipsec.php
src/www/diag_logs_ipsec.php
+2
-34
diag_logs_ntpd.php
src/www/diag_logs_ntpd.php
+1
-1
diag_logs_openvpn.php
src/www/diag_logs_openvpn.php
+1
-1
diag_logs_pills.php
src/www/diag_logs_pills.php
+1
-0
diag_logs_ppp.php
src/www/diag_logs_ppp.php
+1
-1
diag_logs_proxy.php
src/www/diag_logs_proxy.php
+9
-10
diag_logs_relayd.php
src/www/diag_logs_relayd.php
+1
-1
diag_logs_resolver.php
src/www/diag_logs_resolver.php
+1
-1
diag_logs_routing.php
src/www/diag_logs_routing.php
+1
-1
diag_logs_settings.php
src/www/diag_logs_settings.php
+31
-7
diag_logs_tabs.inc
src/www/diag_logs_tabs.inc
+17
-16
diag_logs_vpn.php
src/www/diag_logs_vpn.php
+5
-4
diag_logs_wireless.php
src/www/diag_logs_wireless.php
+1
-1
guiconfig.inc
src/www/guiconfig.inc
+102
-42
No files found.
src/etc/inc/system.inc
View file @
b2af67a9
...
@@ -768,20 +768,14 @@ function system_syslogd_start()
...
@@ -768,20 +768,14 @@ function system_syslogd_start()
$syslogcfg
=
$config
[
'syslog'
];
$syslogcfg
=
$config
[
'syslog'
];
if
(
file_exists
(
"/var/run/booting"
))
if
(
file_exists
(
'/var/run/booting'
))
{
echo
gettext
(
"Starting syslog..."
);
echo
gettext
(
'Starting syslog...'
);
// Which logging type are we using this week??
if
(
isset
(
$config
[
'system'
][
'disablesyslogclog'
]))
{
$log_directive
=
""
;
$log_create_directive
=
"/usr/bin/touch "
;
$log_size
=
""
;
}
else
{
// Defaults to CLOG
$log_directive
=
"%"
;
$log_size
=
isset
(
$config
[
'syslog'
][
'logfilesize'
])
?
$config
[
'syslog'
][
'logfilesize'
]
:
"10240"
;
$log_create_directive
=
"/usr/local/sbin/clog -i -s "
;
}
}
$log_directive
=
'%'
;
$log_size
=
isset
(
$config
[
'syslog'
][
'logfilesize'
])
?
$config
[
'syslog'
][
'logfilesize'
]
:
'511488'
;
$log_create_directive
=
'/usr/local/sbin/clog -i -s '
;
$syslogd_extra
=
""
;
$syslogd_extra
=
""
;
if
(
isset
(
$syslogcfg
))
{
if
(
isset
(
$syslogcfg
))
{
$separatelogfacilities
=
array
(
'ntp'
,
'ntpd'
,
'ntpdate'
,
'charon'
,
'openvpn'
,
'pptps'
,
'poes'
,
'l2tps'
,
'relayd'
,
'hostapd'
,
'dnsmasq'
,
'filterdns'
,
'unbound'
,
'dhcpd'
,
'dhcrelay'
,
'dhclient'
,
'dhcp6c'
,
'apinger'
,
'radvd'
,
'routed'
,
'olsrd'
,
'zebra'
,
'ospfd'
,
'bgpd'
,
'miniupnpd'
,
'filterlog'
);
$separatelogfacilities
=
array
(
'ntp'
,
'ntpd'
,
'ntpdate'
,
'charon'
,
'openvpn'
,
'pptps'
,
'poes'
,
'l2tps'
,
'relayd'
,
'hostapd'
,
'dnsmasq'
,
'filterdns'
,
'unbound'
,
'dhcpd'
,
'dhcrelay'
,
'dhclient'
,
'dhcp6c'
,
'apinger'
,
'radvd'
,
'routed'
,
'olsrd'
,
'zebra'
,
'ospfd'
,
'bgpd'
,
'miniupnpd'
,
'filterlog'
);
...
...
src/etc/rc
View file @
b2af67a9
...
@@ -165,7 +165,6 @@ rm -rf /tmp/*
...
@@ -165,7 +165,6 @@ rm -rf /tmp/*
chmod
1777 /tmp
chmod
1777 /tmp
echo
-n
"."
echo
-n
"."
DISABLESYSLOGCLOG
=
`
/usr/bin/grep
-c
disablesyslogclog /conf/config.xml
`
LOG_FILES
=
"system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppps relayd wireless lighttpd ntpd gateways resolver routing"
LOG_FILES
=
"system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppps relayd wireless lighttpd ntpd gateways resolver routing"
DEFAULT_LOG_FILE_SIZE
=
`
/usr/local/bin/xmllint
--xpath
'string(//opnsense/syslog/logfilesize)'
/conf/config.xml
`
DEFAULT_LOG_FILE_SIZE
=
`
/usr/local/bin/xmllint
--xpath
'string(//opnsense/syslog/logfilesize)'
/conf/config.xml
`
...
@@ -174,13 +173,9 @@ if [ ! ${DEFAULT_LOG_FILE_SIZE} ]; then
...
@@ -174,13 +173,9 @@ if [ ! ${DEFAULT_LOG_FILE_SIZE} ]; then
fi
fi
for
logfile
in
$LOG_FILES
;
do
for
logfile
in
$LOG_FILES
;
do
if
[
"
$DISABLESYSLOGCLOG
"
-gt
"0"
]
;
then
touch
/var/log/
$logfile
.log
else
if
[
!
-f
/var/log/
$logfile
.log
]
;
then
if
[
!
-f
/var/log/
$logfile
.log
]
;
then
clog
-i
-s
${
DEFAULT_LOG_FILE_SIZE
}
/var/log/
$logfile
.log
clog
-i
-s
${
DEFAULT_LOG_FILE_SIZE
}
/var/log/
$logfile
.log
fi
fi
fi
chmod
0600 /var/log/
$logfile
.log
chmod
0600 /var/log/
$logfile
.log
done
done
...
...
src/www/diag_logs.php
View file @
b2af67a9
...
@@ -41,7 +41,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -41,7 +41,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
isset
(
$_POST
[
'clear'
]))
{
if
(
isset
(
$_POST
[
'clear'
]))
{
clear_
log_file
(
$system_logfile
);
clear_
clog
(
$system_logfile
);
}
}
if
(
$_GET
[
'filtertext'
])
{
if
(
$_GET
[
'filtertext'
])
{
...
...
src/www/diag_logs_auth.php
View file @
b2af67a9
...
@@ -41,7 +41,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -41,7 +41,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$portal_logfile
);
clear_
clog
(
$portal_logfile
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Portal Auth"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Portal Auth"
));
...
...
src/www/diag_logs_dhcp.php
View file @
b2af67a9
...
@@ -42,7 +42,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -42,7 +42,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$dhcpd_logfile
);
clear_
clog
(
$dhcpd_logfile
);
killbyname
(
"dhcpd"
);
killbyname
(
"dhcpd"
);
services_dhcpd_configure
();
services_dhcpd_configure
();
}
}
...
...
src/www/diag_logs_filter.php
View file @
b2af67a9
...
@@ -586,9 +586,8 @@ if (isset($filterlogentries_qty) && $filterlogentries_qty != null) {
...
@@ -586,9 +586,8 @@ if (isset($filterlogentries_qty) && $filterlogentries_qty != null) {
$nentries
=
$filterlogentries_qty
;
$nentries
=
$filterlogentries_qty
;
}
}
if
(
isset
(
$_POST
[
'clear'
]))
{
if
(
isset
(
$_POST
[
'clear'
]))
{
clear_
log_file
(
$filter_logfile
);
clear_
clog
(
$filter_logfile
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Firewall"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Firewall"
));
...
@@ -599,7 +598,6 @@ include("head.inc");
...
@@ -599,7 +598,6 @@ include("head.inc");
<script
src=
"/javascript/filter_log.js"
type=
"text/javascript"
></script>
<script
src=
"/javascript/filter_log.js"
type=
"text/javascript"
></script>
<body>
<body>
<?php
include
(
"fbegin.inc"
);
?>
<?php
include
(
"fbegin.inc"
);
?>
...
...
src/www/diag_logs_filter_dynamic.php
View file @
b2af67a9
...
@@ -42,7 +42,7 @@ $nentries = 50;
...
@@ -42,7 +42,7 @@ $nentries = 50;
handle_ajax
(
$nentries
,
$nentries
+
20
);
handle_ajax
(
$nentries
,
$nentries
+
20
);
if
(
isset
(
$_POST
[
'clear'
]))
{
if
(
isset
(
$_POST
[
'clear'
]))
{
clear_
log_file
(
$filter_logfile
);
clear_
clog
(
$filter_logfile
);
}
}
$filterlog
=
conv_log_filter
(
$filter_logfile
,
$nentries
,
$nentries
+
100
);
$filterlog
=
conv_log_filter
(
$filter_logfile
,
$nentries
,
$nentries
+
100
);
...
...
src/www/diag_logs_filter_summary.php
View file @
b2af67a9
<?php
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V. - J. Schellevis
Copyright (C) 2014-2015 Deciso B.V. - J. Schellevis
Copyright (C) 2009 Jim Pingle (jpingle@gmail.com)
Copyright (C) 2009 Jim Pingle (jpingle@gmail.com)
...
...
src/www/diag_logs_gateways.php
View file @
b2af67a9
...
@@ -43,7 +43,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -43,7 +43,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$system_logfile
);
clear_
clog
(
$system_logfile
);
}
}
if
(
$_GET
[
'filtertext'
])
{
if
(
$_GET
[
'filtertext'
])
{
...
...
src/www/diag_logs_ipsec.php
View file @
b2af67a9
...
@@ -34,25 +34,6 @@ require_once("services.inc");
...
@@ -34,25 +34,6 @@ require_once("services.inc");
require_once
(
"system.inc"
);
require_once
(
"system.inc"
);
require_once
(
"interfaces.inc"
);
require_once
(
"interfaces.inc"
);
function
return_clog
(
$logfile
,
$tail
,
$withorig
=
true
,
$grepfor
=
""
,
$grepinvert
=
""
,
$grepreverse
=
false
)
{
global
$g
,
$config
;
$sor
=
(
isset
(
$config
[
'syslog'
][
'reverse'
])
||
$grepreverse
)
?
"-r"
:
""
;
$logarr
=
""
;
$grepline
=
" "
;
if
(
is_array
(
$grepfor
))
$grepline
.=
" | /usr/bin/egrep "
.
escapeshellarg
(
implode
(
"|"
,
$grepfor
));
if
(
is_array
(
$grepinvert
))
$grepline
.=
" | /usr/bin/egrep -v "
.
escapeshellarg
(
implode
(
"|"
,
$grepinvert
));
if
(
$config
[
'system'
][
'disablesyslogclog'
])
{
exec
(
"cat "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
else
{
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| grep -v
\"
CLOG
\"
| grep -v
\"\033\"
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
return
(
$logarr
);
}
$ipsec_logfile
=
'/var/log/ipsec.log'
;
$ipsec_logfile
=
'/var/log/ipsec.log'
;
if
(
empty
(
$config
[
'syslog'
][
'nentries'
]))
{
if
(
empty
(
$config
[
'syslog'
][
'nentries'
]))
{
...
@@ -62,18 +43,15 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -62,18 +43,15 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$ipsec_logfile
);
clear_
clog
(
$ipsec_logfile
);
}
}
$ipsec_logarr
=
return_clog
(
$ipsec_logfile
,
$nentries
);
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"IPsec VPN"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"IPsec VPN"
));
$shortcut_section
=
"ipsec"
;
$shortcut_section
=
"ipsec"
;
include
(
"head.inc"
);
include
(
"head.inc"
);
?>
?>
<body>
<body>
<?php
include
(
"fbegin.inc"
);
?>
<?php
include
(
"fbegin.inc"
);
?>
...
@@ -96,17 +74,7 @@ include("head.inc");
...
@@ -96,17 +74,7 @@ include("head.inc");
<div
class=
"table-responsive"
>
<div
class=
"table-responsive"
>
<table
class=
"table table-striped table-sort"
>
<table
class=
"table table-striped table-sort"
>
<?php
<?php
dump_clog
(
$ipsec_logfile
,
$nentries
);
?>
foreach
(
$ipsec_logarr
as
$logent
){
$logent
=
htmlspecialchars
(
$logent
);
$logent
=
preg_split
(
"/\s+/"
,
$logent
,
6
);
echo
"<tr valign=
\"
top
\"
>
\n
"
;
$entry_date_time
=
htmlspecialchars
(
join
(
" "
,
array_slice
(
$logent
,
0
,
3
)));
echo
"<td class=
\"
listlr nowrap
\"
>"
.
$entry_date_time
.
"</td>
\n
"
;
echo
"<td class=
\"
listr
\"
>"
.
$logent
[
4
]
.
" "
.
$logent
[
5
]
.
"</td>
\n
"
;
echo
"</tr>
\n
"
;
}
?>
</table>
</table>
</div>
</div>
...
...
src/www/diag_logs_ntpd.php
View file @
b2af67a9
...
@@ -43,7 +43,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -43,7 +43,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$ntpd_logfile
);
clear_
clog
(
$ntpd_logfile
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"NTP"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"NTP"
));
...
...
src/www/diag_logs_openvpn.php
View file @
b2af67a9
...
@@ -46,7 +46,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -46,7 +46,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$openvpn_logfile
);
clear_
clog
(
$openvpn_logfile
);
}
}
include
(
"head.inc"
);
include
(
"head.inc"
);
...
...
src/www/diag_logs_pills.php
View file @
b2af67a9
<?php
<?php
/*
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2014 Deciso B.V.
All rights reserved.
All rights reserved.
...
...
src/www/diag_logs_ppp.php
View file @
b2af67a9
...
@@ -41,7 +41,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -41,7 +41,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$ppps_logfile
);
clear_
clog
(
$ppps_logfile
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"PPP"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"PPP"
));
...
...
src/www/diag_logs_proxy.php
View file @
b2af67a9
<?php
<?php
/*
/*
Copyright (C) 2015 Deciso B.V.
Copyright (C) 2015 Deciso B.V.
All rights reserved.
All rights reserved.
...
@@ -26,6 +27,7 @@
...
@@ -26,6 +27,7 @@
*/
*/
require_once
(
"guiconfig.inc"
);
require_once
(
"guiconfig.inc"
);
require_once
(
"system.inc"
);
$logfile
=
'/var/log/squid/cache.log'
;
$logfile
=
'/var/log/squid/cache.log'
;
...
@@ -36,10 +38,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -36,10 +38,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
// trash log file
clear_log
(
$logfile
);
$handle
=
fopen
(
$logfile
,
'r+'
);
ftruncate
(
$handle
,
0
);
fclose
(
$handle
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Proxy"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Proxy"
));
...
@@ -57,12 +56,12 @@ include("head.inc");
...
@@ -57,12 +56,12 @@ include("head.inc");
<?
include
(
'diag_logs_tabs.inc'
);
?>
<?
include
(
'diag_logs_tabs.inc'
);
?>
<div
class=
"tab-content content-box col-xs-12"
>
<div
class=
"tab-content content-box col-xs-12"
>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<p>
<?php
printf
(
gettext
(
"Last %s log entries"
),
$max_log
entries
);
?>
</p>
<p>
<?php
printf
(
gettext
(
"Last %s Proxy log entries"
),
$n
entries
);
?>
</p>
<
pre>
<?php
<
div
class=
"table-responsive"
>
if
(
file_exists
(
$logfile
))
{
<table
class=
"table table-striped table-sort"
>
echo
trim
(
implode
(
""
,
array_slice
(
file
(
$logfile
),
-
$max_logentries
)));
<?php
dump_log
(
$logfile
,
$nentries
);
?>
}
</table>
?>
</pre
>
</div
>
<form
method=
"post"
>
<form
method=
"post"
>
<input
name=
"clear"
type=
"submit"
class=
"btn"
value=
"
<?=
gettext
(
"Clear log"
);
?>
"
/>
<input
name=
"clear"
type=
"submit"
class=
"btn"
value=
"
<?=
gettext
(
"Clear log"
);
?>
"
/>
</form>
</form>
...
...
src/www/diag_logs_relayd.php
View file @
b2af67a9
...
@@ -42,7 +42,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -42,7 +42,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$relayd_logfile
);
clear_
clog
(
$relayd_logfile
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Load Balancer"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Load Balancer"
));
...
...
src/www/diag_logs_resolver.php
View file @
b2af67a9
...
@@ -43,7 +43,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -43,7 +43,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$system_logfile
);
clear_
clog
(
$system_logfile
);
}
}
if
(
$_GET
[
'filtertext'
])
{
if
(
$_GET
[
'filtertext'
])
{
...
...
src/www/diag_logs_routing.php
View file @
b2af67a9
...
@@ -40,7 +40,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -40,7 +40,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$routing_logfile
);
clear_
clog
(
$routing_logfile
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Routing"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Routing"
));
...
...
src/www/diag_logs_settings.php
View file @
b2af67a9
<?php
<?php
/*
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich
Copyright (C) 2004-2009 Scott Ullrich
...
@@ -38,22 +39,45 @@ function clear_all_log_files()
...
@@ -38,22 +39,45 @@ function clear_all_log_files()
{
{
killbyname
(
'syslogd'
);
killbyname
(
'syslogd'
);
$clog_files
=
array
(
'dhcpd'
,
'filter'
,
'gateways'
,
'ipsec'
,
'l2tps'
,
'lighttpd'
,
'ntpd'
,
'openvpn'
,
'poes'
,
'portalauth'
,
'ppps'
,
'pptps'
,
'relayd'
,
'resolver'
,
'routing'
,
'system'
,
'vpn'
,
'wireless'
,
);
foreach
(
$clog_files
as
$lfile
)
{
clear_clog
(
"/var/log/
{
$lfile
}
.log"
,
false
);
}
$log_files
=
array
(
$log_files
=
array
(
"system"
,
"filter"
,
"dhcpd"
,
"vpn"
,
"pptps"
,
"poes"
,
"l2tps"
,
"openvpn"
,
"portalauth"
,
'squid/access'
,
"ipsec"
,
"ppps"
,
"relayd"
,
"wireless"
,
"lighttpd"
,
"ntpd"
,
"gateways"
,
"resolver"
,
"routing"
'squid/cache'
,
);
);
foreach
(
$log_files
as
$lfile
)
{
foreach
(
$
c
log_files
as
$lfile
)
{
clear_log
_file
(
"/var/log/
{
$lfile
}
.log"
,
false
);
clear_log
(
"/var/log/
{
$lfile
}
.log"
,
false
);
}
}
system_syslogd_start
();
system_syslogd_start
();
killbyname
(
"dhcpd"
);
killbyname
(
'dhcpd'
);
services_dhcpd_configure
();
services_dhcpd_configure
();
}
}
$pconfig
[
'reverse'
]
=
isset
(
$config
[
'syslog'
][
'reverse'
]);
$pconfig
[
'reverse'
]
=
isset
(
$config
[
'syslog'
][
'reverse'
]);
$pconfig
[
'nentries'
]
=
$config
[
'syslog'
][
'nentries'
];
$pconfig
[
'nentries'
]
=
$config
[
'syslog'
][
'nentries'
];
$pconfig
[
'remoteserver'
]
=
$config
[
'syslog'
][
'remoteserver'
];
$pconfig
[
'remoteserver'
]
=
$config
[
'syslog'
][
'remoteserver'
];
...
...
src/www/diag_logs_tabs.inc
View file @
b2af67a9
<?php
<?php
/*
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2014 Deciso B.V.
All rights reserved.
All rights reserved.
...
@@ -24,19 +25,19 @@
...
@@ -24,19 +25,19 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
*/
*/
$active_tab
=
isset
(
$active_tab
)
?
$active_tab
:
$_SERVER
[
'PHP_SELF'
];
$tab_array
=
array
()
;
$active_tab
=
isset
(
$active_tab
)
?
$active_tab
:
$_SERVER
[
'PHP_SELF'
]
;
$tab_array
[]
=
array
(
gettext
(
"System"
),
$active_tab
==
"/diag_logs.php"
,
"diag_logs.php"
);
$tab_array
=
array
(
);
$tab_array
[]
=
array
(
gettext
(
"Firewall"
),
$active_tab
==
"/diag_logs_filter.php"
,
"diag_logs_filter
.php"
);
$tab_array
[]
=
array
(
gettext
(
"System"
),
$active_tab
==
"/diag_logs.php"
,
"diag_logs
.php"
);
$tab_array
[]
=
array
(
gettext
(
"DHCP"
),
$active_tab
==
"/diag_logs_dhcp.php"
,
"diag_logs_dhcp
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Firewall"
),
$active_tab
==
"/diag_logs_filter.php"
,
"diag_logs_filter
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Portal Auth"
),
$active_tab
==
"/diag_logs_auth.php"
,
"diag_logs_auth
.php"
);
$tab_array
[]
=
array
(
gettext
(
"DHCP"
),
$active_tab
==
"/diag_logs_dhcp.php"
,
"diag_logs_dhcp
.php"
);
$tab_array
[]
=
array
(
gettext
(
"IPsec"
),
$active_tab
==
"/diag_logs_ipsec.php"
,
"diag_logs_ipsec
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Portal Auth"
),
$active_tab
==
"/diag_logs_auth.php"
,
"diag_logs_auth
.php"
);
$tab_array
[]
=
array
(
gettext
(
"PPP"
),
$active_tab
==
"/diag_logs_ppp.php"
,
"diag_logs_ppp
.php"
);
$tab_array
[]
=
array
(
gettext
(
"IPsec"
),
$active_tab
==
"/diag_logs_ipsec.php"
,
"diag_logs_ipsec
.php"
);
$tab_array
[]
=
array
(
gettext
(
"VPN"
),
$active_tab
==
"/diag_logs_vpn.php"
,
"diag_logs_vpn
.php"
);
$tab_array
[]
=
array
(
gettext
(
"PPP"
),
$active_tab
==
"/diag_logs_ppp.php"
,
"diag_logs_ppp
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Load Balancer"
),
$active_tab
==
"/diag_logs_relayd.php"
,
"diag_logs_relayd
.php"
);
$tab_array
[]
=
array
(
gettext
(
"VPN"
),
$active_tab
==
"/diag_logs_vpn.php"
,
"diag_logs_vpn
.php"
);
$tab_array
[]
=
array
(
gettext
(
"OpenVPN"
),
$active_tab
==
"/diag_logs_openvpn.php"
,
"diag_logs_openvpn
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Load Balancer"
),
$active_tab
==
"/diag_logs_relayd.php"
,
"diag_logs_relayd
.php"
);
$tab_array
[]
=
array
(
gettext
(
"NTP"
),
$active_tab
==
"/diag_logs_ntpd.php"
,
"diag_logs_ntpd
.php"
);
$tab_array
[]
=
array
(
gettext
(
"OpenVPN"
),
$active_tab
==
"/diag_logs_openvpn.php"
,
"diag_logs_openvpn
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Proxy"
),
$active_tab
==
"/diag_logs_proxy.php"
,
"diag_logs_proxy
.php"
);
$tab_array
[]
=
array
(
gettext
(
"NTP"
),
$active_tab
==
"/diag_logs_ntpd.php"
,
"diag_logs_ntpd
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Settings"
),
$active_tab
==
"/diag_logs_settings.php"
,
"diag_logs_settings
.php"
);
$tab_array
[]
=
array
(
gettext
(
"Proxy"
),
$active_tab
==
"/diag_logs_proxy.php"
,
"diag_logs_proxy
.php"
);
display_top_tabs
(
$tab_array
);
$tab_array
[]
=
array
(
gettext
(
"Settings"
),
$active_tab
==
"/diag_logs_settings.php"
,
"diag_logs_settings.php"
);
?>
display_top_tabs
(
$tab_array
);
src/www/diag_logs_vpn.php
View file @
b2af67a9
...
@@ -66,10 +66,11 @@ switch ($vpntype) {
...
@@ -66,10 +66,11 @@ switch ($vpntype) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
if
(
$mode
!=
"raw"
)
if
(
$mode
!=
"raw"
)
{
clear_log_file
(
"/var/log/vpn.log"
);
clear_clog
(
"/var/log/vpn.log"
);
else
}
else
{
clear_log_file
(
"/var/log/
{
$logname
}
.log"
);
clear_clog
(
"/var/log/
{
$logname
}
.log"
);
}
}
}
function
dump_clog_vpn
(
$logfile
,
$tail
)
{
function
dump_clog_vpn
(
$logfile
,
$tail
)
{
...
...
src/www/diag_logs_wireless.php
View file @
b2af67a9
...
@@ -42,7 +42,7 @@ if (empty($config['syslog']['nentries'])) {
...
@@ -42,7 +42,7 @@ if (empty($config['syslog']['nentries'])) {
}
}
if
(
$_POST
[
'clear'
])
{
if
(
$_POST
[
'clear'
])
{
clear_
log_file
(
$wireless_logfile
);
clear_
clog
(
$wireless_logfile
);
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Wireless"
));
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"System logs"
),
gettext
(
"Wireless"
));
...
...
src/www/guiconfig.inc
View file @
b2af67a9
...
@@ -347,43 +347,48 @@ function update_changedesc($update) {
...
@@ -347,43 +347,48 @@ function update_changedesc($update) {
$changecount
++
;
$changecount
++
;
}
}
function
clear_log
_file
(
$logfile
=
'/var/log/system.log'
,
$restart_syslogd
=
true
)
function
clear_log
(
$logfile
,
$restart_syslogd
=
true
)
{
{
global
$config
,
$g
;
if
(
$restart_syslogd
)
{
if
(
$restart_syslogd
)
killbyname
(
'syslogd'
);
exec
(
"/usr/bin/killall syslogd"
);
if
(
isset
(
$config
[
'system'
][
'disablesyslogclog'
]))
{
unlink
(
$logfile
);
touch
(
$logfile
);
}
else
{
$log_size
=
isset
(
$config
[
'syslog'
][
'logfilesize'
])
?
$config
[
'syslog'
][
'logfilesize'
]
:
"511488"
;
exec
(
"/usr/local/sbin/clog -i -s
{
$log_size
}
"
.
escapeshellarg
(
$logfile
));
}
}
foreach
(
glob
(
$logfile
.
'.*'
)
as
$rotated
)
{
@
unlink
(
$rotated
);
}
/* preserve file ownership and permissions */
$handle
=
fopen
(
$logfile
,
'r+'
);
if
(
$handle
)
{
ftruncate
(
$handle
,
0
);
fclose
(
$handle
);
}
if
(
$restart_syslogd
)
{
if
(
$restart_syslogd
)
{
system_syslogd_start
();
system_syslogd_start
();
}
}
}
}
function
dump_clog
(
$logfile
,
$tail
,
$withorig
=
true
,
$grepfor
=
""
,
$grepinvert
=
""
)
{
function
clear_clog
(
$logfile
,
$restart_syslogd
=
true
)
global
$g
,
$config
;
{
$sor
=
isset
(
$config
[
'syslog'
][
'reverse'
])
?
"-r"
:
""
;
global
$config
;
$logarr
=
""
;
$grepline
=
" "
;
if
(
$restart_syslogd
)
{
if
(
is_array
(
$grepfor
))
killbyname
(
'syslogd'
);
$grepline
.=
" | /usr/bin/egrep "
.
escapeshellarg
(
implode
(
"|"
,
$grepfor
));
if
(
is_array
(
$grepinvert
))
$grepline
.=
" | /usr/bin/egrep -v "
.
escapeshellarg
(
implode
(
"|"
,
$grepinvert
));
if
(
is_dir
(
$logfile
))
{
$logarr
=
array
(
"File
$logfile
is a directory."
);
}
elseif
(
file_exists
(
$logfile
)
&&
filesize
(
$logfile
)
==
0
)
{
$logarr
=
array
(
"Log file started."
);
}
else
{
if
(
$config
[
'system'
][
'disablesyslogclog'
])
{
exec
(
"cat "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
else
{
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| grep -v
\"
CLOG
\"
| grep -v
\"\033\"
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
}
$log_size
=
isset
(
$config
[
'syslog'
][
'logfilesize'
])
?
$config
[
'syslog'
][
'logfilesize'
]
:
'511488'
;
mwexecf
(
'/usr/local/sbin/clog -i -s %s %s'
,
array
(
$log_size
,
$logfile
));
if
(
$restart_syslogd
)
{
system_syslogd_start
();
}
}
}
function
print_dump
(
$logarr
,
$withorig
)
{
global
$config
;
foreach
(
$logarr
as
$logent
)
{
foreach
(
$logarr
as
$logent
)
{
$logent
=
preg_split
(
"/\s+/"
,
$logent
,
6
);
$logent
=
preg_split
(
"/\s+/"
,
$logent
,
6
);
echo
"<tr valign=
\"
top
\"
>
\n
"
;
echo
"<tr valign=
\"
top
\"
>
\n
"
;
...
@@ -400,6 +405,63 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert
...
@@ -400,6 +405,63 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert
}
}
}
}
function
dump_clog
(
$logfile
,
$tail
,
$withorig
=
true
,
$grepfor
=
''
,
$grepinvert
=
''
)
{
global
$config
;
$sor
=
isset
(
$config
[
'syslog'
][
'reverse'
])
?
'-r'
:
''
;
$grepline
=
' '
;
$logarr
=
''
;
if
(
is_array
(
$grepfor
))
{
$grepline
.=
" | /usr/bin/egrep "
.
escapeshellarg
(
implode
(
"|"
,
$grepfor
));
}
if
(
is_array
(
$grepinvert
))
{
$grepline
.=
" | /usr/bin/egrep -v "
.
escapeshellarg
(
implode
(
"|"
,
$grepinvert
));
}
if
(
is_dir
(
$logfile
))
{
$logarr
=
array
(
"File
$logfile
is a directory."
);
}
elseif
(
!
file_exists
(
$logfile
))
{
$logarr
=
array
(
"File
$logfile
doesn't exist."
);
}
elseif
(
filesize
(
$logfile
)
==
0
)
{
$logarr
=
array
(
"Log file started."
);
}
else
{
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| grep -v
\"
CLOG
\"
| grep -v
\"\033\"
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
print_dump
(
$logarr
,
$withorig
);
}
function
dump_log
(
$logfile
,
$tail
,
$withorig
=
true
,
$grepfor
=
''
,
$grepinvert
=
''
)
{
global
$config
;
$sor
=
isset
(
$config
[
'syslog'
][
'reverse'
])
?
'-r'
:
''
;
$grepline
=
' '
;
$logarr
=
''
;
if
(
is_array
(
$grepfor
))
{
$grepline
.=
" | /usr/bin/egrep "
.
escapeshellarg
(
implode
(
"|"
,
$grepfor
));
}
if
(
is_array
(
$grepinvert
))
{
$grepline
.=
" | /usr/bin/egrep -v "
.
escapeshellarg
(
implode
(
"|"
,
$grepinvert
));
}
if
(
is_dir
(
$logfile
))
{
$logarr
=
array
(
"File
$logfile
is a directory."
);
}
elseif
(
!
file_exists
(
$logfile
))
{
$logarr
=
array
(
"File
$logfile
doesn't exist."
);
}
elseif
(
filesize
(
$logfile
)
==
0
)
{
$logarr
=
array
(
"Log file started."
);
}
else
{
exec
(
"cat "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
print_dump
(
$logarr
,
$withorig
);
}
/* Check if variable has changed, update and log if it has
/* Check if variable has changed, update and log if it has
* returns true if var changed
* returns true if var changed
...
@@ -523,9 +585,10 @@ function is_specialnet($net) {
...
@@ -523,9 +585,10 @@ function is_specialnet($net) {
* RESULT
* RESULT
* null
* null
******/
******/
function
display_top_tabs
(
&
$tab_array
,
$no_drop_down
=
false
)
{
function
display_top_tabs
(
&
$tab_array
,
$no_drop_down
=
false
)
{
global
$config
;
global
$config
;
global
$g
;
$tab_array_char_limit
=
92
;
$tab_array_char_limit
=
92
;
/* does the user have access to this tab?
/* does the user have access to this tab?
...
@@ -583,9 +646,6 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) {
...
@@ -583,9 +646,6 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) {
}
}
}
}
$timezone
=
$config
[
'system'
][
'timezone'
];
$timezone
=
$config
[
'system'
][
'timezone'
];
if
(
!
$timezone
)
{
if
(
!
$timezone
)
{
$timezone
=
'Etc/UTC'
;
$timezone
=
'Etc/UTC'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment