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
a2af9837
Commit
a2af9837
authored
Jul 01, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: purge long gone fifolog support
parent
8d65afe8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
57 deletions
+17
-57
filter_log.inc
src/etc/inc/filter_log.inc
+1
-4
system.inc
src/etc/inc/system.inc
+0
-7
rc
src/etc/rc
+3
-11
diag_logs_vpn.php
src/www/diag_logs_vpn.php
+1
-4
guiconfig.inc
src/www/guiconfig.inc
+10
-24
status.php
src/www/status.php
+2
-7
No files found.
src/etc/inc/filter_log.inc
View file @
a2af9837
...
...
@@ -49,10 +49,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = '', $fil
/* Always do a reverse tail, to be sure we're grabbing the 'end' of the log. */
$logarr
=
""
;
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
exec
(
"/usr/sbin/fifolog_reader "
.
escapeshellarg
(
$logfile
)
.
" | /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n
{
$tail
}
"
,
$logarr
);
else
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
" | grep -v
\"
CLOG
\"
| grep -v
\"\033\"
| /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n
{
$tail
}
"
,
$logarr
);
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
" | grep -v
\"
CLOG
\"
| grep -v
\"\033\"
| /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n
{
$tail
}
"
,
$logarr
);
$filterlog
=
array
();
$counter
=
0
;
...
...
src/etc/inc/system.inc
View file @
a2af9837
...
...
@@ -633,18 +633,11 @@ function system_syslogd_start()
if
(
file_exists
(
"/var/run/booting"
))
echo
gettext
(
"Starting syslog..."
);
if
(
is_process_running
(
"fifolog_writer"
))
mwexec
(
'/bin/pkill fifolog_writer'
);
// Which logging type are we using this week??
if
(
isset
(
$config
[
'system'
][
'disablesyslogclog'
]))
{
$log_directive
=
""
;
$log_create_directive
=
"/usr/bin/touch "
;
$log_size
=
""
;
}
else
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
{
$log_directive
=
"|/usr/sbin/fifolog_writer "
;
$log_size
=
isset
(
$config
[
'syslog'
][
'logfilesize'
])
?
$config
[
'syslog'
][
'logfilesize'
]
:
"10240"
;
$log_create_directive
=
"/usr/sbin/fifolog_create -s "
;
}
else
{
// Defaults to CLOG
$log_directive
=
"%"
;
$log_size
=
isset
(
$config
[
'syslog'
][
'logfilesize'
])
?
$config
[
'syslog'
][
'logfilesize'
]
:
"10240"
;
...
...
src/etc/rc
View file @
a2af9837
...
...
@@ -185,7 +185,6 @@ chmod 1777 /tmp
echo
-n
"."
DISABLESYSLOGCLOG
=
`
/usr/bin/grep
-c
disablesyslogclog /conf/config.xml
`
ENABLEFIFOLOG
=
`
/usr/bin/grep
-c
usefifolog /conf/config.xml
`
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
`
...
...
@@ -195,22 +194,15 @@ fi
for
logfile
in
$LOG_FILES
;
do
if
[
"
$DISABLESYSLOGCLOG
"
-gt
"0"
]
;
then
/usr/bin/
touch /var/log/
$logfile
.log
touch
/var/log/
$logfile
.log
else
if
[
!
-f
/var/log/
$logfile
.log
]
;
then
if
[
"
$ENABLEFIFOLOG
"
-gt
"0"
]
;
then
# generate fifolog files
/usr/sbin/fifolog_create
-s
${
DEFAULT_LOG_FILE_SIZE
}
/var/log/
$logfile
.log
else
/usr/local/sbin/clog
-i
-s
${
DEFAULT_LOG_FILE_SIZE
}
/var/log/
$logfile
.log
fi
clog
-i
-s
${
DEFAULT_LOG_FILE_SIZE
}
/var/log/
$logfile
.log
fi
fi
chmod
0600 /var/log/
$logfile
.log
done
# change permissions on newly created fifolog files.
chmod
0600 /var/log/
*
.log
echo
-n
"."
/sbin/ldconfig
-elf
/usr/lib /usr/local/lib /lib
/etc/rc.d/ldconfig start 2>/dev/null
...
...
src/www/diag_logs_vpn.php
View file @
a2af9837
...
...
@@ -75,10 +75,7 @@ function dump_clog_vpn($logfile, $tail) {
$logarr
=
""
;
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
exec
(
"/usr/sbin/fifolog_reader "
.
escapeshellarg
(
$logfile
)
.
" | tail
{
$sor
}
-n "
.
$tail
,
$logarr
);
else
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
" | tail
{
$sor
}
-n "
.
$tail
,
$logarr
);
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
" | tail
{
$sor
}
-n "
.
$tail
,
$logarr
);
foreach
(
$logarr
as
$logent
)
{
$logent
=
preg_split
(
"/\s+/"
,
$logent
,
6
);
...
...
src/www/guiconfig.inc
View file @
a2af9837
...
...
@@ -483,7 +483,8 @@ function update_changedesc($update) {
$changecount
++
;
}
function
clear_log_file
(
$logfile
=
"/var/log/system.log"
,
$restart_syslogd
=
true
)
{
function
clear_log_file
(
$logfile
=
'/var/log/system.log'
,
$restart_syslogd
=
true
)
{
global
$config
,
$g
;
if
(
$restart_syslogd
)
exec
(
"/usr/bin/killall syslogd"
);
...
...
@@ -492,13 +493,11 @@ function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = tru
touch
(
$logfile
);
}
else
{
$log_size
=
isset
(
$config
[
'syslog'
][
'logfilesize'
])
?
$config
[
'syslog'
][
'logfilesize'
]
:
"511488"
;
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
exec
(
"/usr/sbin/fifolog_create -s
{
$log_size
}
"
.
escapeshellarg
(
$logfile
));
else
exec
(
"/usr/local/sbin/clog -i -s
{
$log_size
}
"
.
escapeshellarg
(
$logfile
));
exec
(
"/usr/local/sbin/clog -i -s
{
$log_size
}
"
.
escapeshellarg
(
$logfile
));
}
if
(
$restart_syslogd
)
if
(
$restart_syslogd
)
{
system_syslogd_start
();
}
}
function
clear_all_log_files
()
...
...
@@ -536,27 +535,18 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert
if
(
$config
[
'system'
][
'disablesyslogclog'
])
{
exec
(
"cat "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
else
{
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
exec
(
"/usr/sbin/fifolog_reader "
.
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
);
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| grep -v
\"
CLOG
\"
| grep -v
\"\033\"
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
}
foreach
(
$logarr
as
$logent
)
{
$logent
=
preg_split
(
"/\s+/"
,
$logent
,
6
);
echo
"<tr valign=
\"
top
\"
>
\n
"
;
if
(
$withorig
)
{
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
{
$entry_date_time
=
htmlspecialchars
(
date
(
"F j, Y, g:i a"
,
""
.
$logent
[
1
]
.
""
));
$entry_text
=
htmlspecialchars
(
$logent
[
5
]);
}
else
{
$entry_date_time
=
htmlspecialchars
(
join
(
" "
,
array_slice
(
$logent
,
0
,
3
)));
$entry_text
=
(
$logent
[
3
]
==
$config
[
'system'
][
'hostname'
])
?
""
:
$logent
[
3
]
.
" "
;
$entry_text
.=
htmlspecialchars
(
$logent
[
4
]
.
" "
.
$logent
[
5
]);
}
$entry_date_time
=
htmlspecialchars
(
join
(
" "
,
array_slice
(
$logent
,
0
,
3
)));
$entry_text
=
(
$logent
[
3
]
==
$config
[
'system'
][
'hostname'
])
?
""
:
$logent
[
3
]
.
" "
;
$entry_text
.=
htmlspecialchars
(
$logent
[
4
]
.
" "
.
$logent
[
5
]);
echo
"<td class=
\"
listlr nowrap
\"
>
{
$entry_date_time
}
</td>
\n
"
;
echo
"<td class=
\"
listr
\"
>
{
$entry_text
}
</td>
\n
"
;
}
else
{
echo
"<td class=
\"
listlr
\"
colspan=
\"
2
\"
>"
.
htmlspecialchars
(
$logent
[
5
])
.
"</td>
\n
"
;
}
...
...
@@ -576,11 +566,7 @@ function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinve
if
(
$config
[
'system'
][
'disablesyslogclog'
])
{
exec
(
"cat "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
else
{
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
{
exec
(
"/usr/sbin/fifolog_reader "
.
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
);
}
exec
(
"/usr/local/sbin/clog "
.
escapeshellarg
(
$logfile
)
.
"
{
$grepline
}
| grep -v
\"
CLOG
\"
| grep -v
\"\033\"
| /usr/bin/tail
{
$sor
}
-n "
.
escapeshellarg
(
$tail
),
$logarr
);
}
return
(
$logarr
);
}
...
...
src/www/status.php
View file @
a2af9837
...
...
@@ -162,13 +162,8 @@ defCmdT("ipsec.conf","cat /usr/local/etc/ipsec.conf");
defCmdT
(
"SPD"
,
"/sbin/setkey -DP"
);
defCmdT
(
"SAD"
,
"/sbin/setkey -D"
);
if
(
isset
(
$config
[
'system'
][
'usefifolog'
]))
{
defCmdT
(
"last 200 system log entries"
,
"/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 200"
);
defCmdT
(
"last 50 filter log entries"
,
"/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 50"
);
}
else
{
defCmdT
(
"last 200 system log entries"
,
"/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 200"
);
defCmdT
(
"last 50 filter log entries"
,
"/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 50"
);
}
defCmdT
(
"last 200 system log entries"
,
"/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 200"
);
defCmdT
(
"last 50 filter log entries"
,
"/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 50"
);
defCmd
(
"ls /conf"
);
defCmd
(
"ls /var/run"
);
...
...
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