Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resmon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrors
resmon
Commits
24996a35
Commit
24996a35
authored
12 years ago
by
Mark Harrison
Browse files
Options
Downloads
Patches
Plain Diff
Limit the number of error lines that can be contained in errstring
parent
737e03ad
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Core/Log.pm
+11
-2
11 additions, 2 deletions
lib/Core/Log.pm
with
11 additions
and
2 deletions
lib/Core/Log.pm
+
11
−
2
View file @
24996a35
...
@@ -44,6 +44,11 @@ The name of the file to monitor.
...
@@ -44,6 +44,11 @@ The name of the file to monitor.
Regular expression for matching error lines.
Regular expression for matching error lines.
=item maxerrs
Maximum number of error lines to include in the error string output. Defaults
to 5.
=back
=back
=head1 METRICS
=head1 METRICS
...
@@ -67,6 +72,8 @@ sub handler {
...
@@ -67,6 +72,8 @@ sub handler {
my
$config
=
$self
->
{
config
};
my
$config
=
$self
->
{
config
};
my
$file
=
$config
->
{
filename
};
my
$file
=
$config
->
{
filename
};
$config
->
{
maxerrs
}
=
5
unless
exists
(
$config
->
{
maxerrs
});
my
@statinfo
=
stat
(
$file
);
my
@statinfo
=
stat
(
$file
);
if
(
!
exists
(
$self
->
{
file_dev
})
||
if
(
!
exists
(
$self
->
{
file_dev
})
||
...
@@ -89,8 +96,10 @@ sub handler {
...
@@ -89,8 +96,10 @@ sub handler {
while
(
<
$log
>
)
{
while
(
<
$log
>
)
{
chomp
;
chomp
;
if
(
/$config->{match}/
)
{
if
(
/$config->{match}/
)
{
$self
->
{
errstring
}
.=
"
"
if
(
length
(
$self
->
{
errstring
}));
if
(
$self
->
{
errs
}
<
$config
->
{
maxerrs
})
{
$self
->
{
errstring
}
.=
$_
;
$self
->
{
errstring
}
.=
"
"
if
(
length
(
$self
->
{
errstring
}));
$self
->
{
errstring
}
.=
$_
;
}
$self
->
{
errs
}
++
;
$self
->
{
errs
}
++
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment