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
298f0c2e
Commit
298f0c2e
authored
Jul 08, 2015
by
Ad Schellevis
Committed by
Franco Fichtner
Jul 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) some minor cleanups to filter_log.inc
parent
3bab3c64
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
filter_log.inc
src/etc/inc/filter_log.inc
+17
-12
No files found.
src/etc/inc/filter_log.inc
View file @
298f0c2e
...
...
@@ -43,8 +43,9 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = '', $fil
if
(
!
(
is_numeric
(
$tail
)))
return
;
if
(
$filtertext
)
if
(
$filtertext
!=
""
){
$tail
=
5000
;
}
/* Always do a reverse tail, to be sure we're grabbing the 'end' of the log. */
$logarr
=
""
;
...
...
@@ -54,21 +55,23 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = '', $fil
$filterlog
=
array
();
$counter
=
0
;
$filterinterface
=
strtoupper
(
$filterinterface
);
foreach
(
$logarr
as
$logent
)
{
if
(
$counter
>=
$nentries
)
break
;
$flent
=
parse_filter_line
(
$logent
);
if
(
!
$filterinterface
||
(
$filterinterface
==
$flent
[
'interface'
]))
{
if
(
(
(
$flent
!=
""
)
&&
(
!
is_array
(
$filtertext
))
&&
(
match_filter_line
(
$flent
,
$filtertext
)))
||
(
(
$flent
!=
""
)
&&
(
is_array
(
$filtertext
))
&&
(
match_filter_field
(
$flent
,
$filtertext
))
)
)
{
if
(
isset
(
$flent
)
&&
is_array
(
$flent
))
{
if
(
$filterinterface
==
null
||
strtoupper
(
$filterinterface
)
==
$flent
[
'interface'
])
{
if
(
(
!
is_array
(
$filtertext
)
&&
match_filter_line
(
$flent
,
$filtertext
))
||
(
is_array
(
$filtertext
)
&&
match_filter_field
(
$flent
,
$filtertext
))
)
{
$counter
++
;
$filterlog
[]
=
$flent
;
}
}
}
}
/* Since the lines are in reverse order, flip them around if needed based on the user's preference */
return
isset
(
$config
[
'syslog'
][
'reverse'
])
?
$filterlog
:
array_reverse
(
$filterlog
);
}
...
...
@@ -248,7 +251,9 @@ function parse_filter_line($line)
$flent
[
'icmp_ttime'
]
=
$rule_data
[
$field
++
];
break
;
default
:
if
(
isset
(
$rule_data
[
$field
++
]))
{
$flent
[
'icmp_descr'
]
=
$rule_data
[
$field
++
];
}
break
;
}
}
elseif
(
$flent
[
'protoid'
]
==
'112'
)
{
// CARP
...
...
@@ -378,11 +383,11 @@ function find_action_image($action)
/* AJAX specific handlers */
function
handle_ajax
(
$nentries
,
$tail
=
50
)
{
global
$config
;
if
(
$_GET
[
'lastsawtime'
]
or
$_POST
[
'lastsawtime'
]
)
{
if
(
isset
(
$_GET
[
'lastsawtime'
])
||
isset
(
$_POST
[
'lastsawtime'
])
)
{
global
$filter_logfile
,
$filterent
;
if
(
$_GET
[
'lastsawtime'
]
)
if
(
isset
(
$_GET
[
'lastsawtime'
])
)
$lastsawtime
=
$_GET
[
'lastsawtime'
];
if
(
$_POST
[
'lastsawtime'
]
)
if
(
isset
(
$_POST
[
'lastsawtime'
])
)
$lastsawtime
=
$_POST
[
'lastsawtime'
];
/* compare lastsawrule's time stamp to filter logs.
* afterwards return the newer records so that client
...
...
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