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