Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
isgphys
python
Commits
d90f8ebb
Commit
d90f8ebb
authored
7 years ago
by
Sven Mäder
Browse files
Options
Downloads
Patches
Plain Diff
Change log severity for some output
parent
8b348f4b
No related branches found
No related tags found
1 merge request
!12
Deltalogparse
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/deltalogparse.py
+8
-6
8 additions, 6 deletions
bin/deltalogparse.py
with
8 additions
and
6 deletions
bin/deltalogparse.py
+
8
−
6
View file @
d90f8ebb
...
@@ -176,7 +176,9 @@ def log_action(action, entry):
...
@@ -176,7 +176,9 @@ def log_action(action, entry):
if
not
action
==
'
skip
'
:
if
not
action
==
'
skip
'
:
log
.
debug
(
'
entry:
'
)
log
.
debug
(
'
entry:
'
)
log
.
debug
(
pprint
.
pformat
(
entry
,
indent
=
1
))
log
.
debug
(
pprint
.
pformat
(
entry
,
indent
=
1
))
log
.
info
(
'
{}: {} {}
'
.
format
(
action
,
req_type
,
req_dn
))
log
.
info
(
'
{}: {} {}
'
.
format
(
action
,
req_type
,
req_dn
))
else
:
log
.
debug
(
'
{}: {} {}
'
.
format
(
action
,
req_type
,
req_dn
))
def
write
(
entry
):
def
write
(
entry
):
...
@@ -207,7 +209,7 @@ def sleep(start_time):
...
@@ -207,7 +209,7 @@ def sleep(start_time):
elapsed_time
=
current_time
-
start_time
elapsed_time
=
current_time
-
start_time
sleep_time
=
update_every
-
elapsed_time
sleep_time
=
update_every
-
elapsed_time
log
.
info
(
'
runtime {0:.3f}s, sleeping {1:.3f}s
'
.
format
(
elapsed_time
,
sleep_time
))
log
.
debug
(
'
runtime {0:.3f}s, sleeping {1:.3f}s
'
.
format
(
elapsed_time
,
sleep_time
))
if
sleep_time
>
0
:
if
sleep_time
>
0
:
time
.
sleep
(
sleep_time
)
time
.
sleep
(
sleep_time
)
...
@@ -224,7 +226,7 @@ def main():
...
@@ -224,7 +226,7 @@ def main():
log
.
error
(
'
connected to slapd
'
)
log
.
error
(
'
connected to slapd
'
)
try
:
try
:
log
.
info
(
'
trying to read last req from {}
'
.
format
(
log_file_deltalog
))
log
.
error
(
'
trying to read last req from {}
'
.
format
(
log_file_deltalog
))
last_line
=
getlastline
(
log_file_deltalog
).
decode
(
'
utf-8
'
)
last_line
=
getlastline
(
log_file_deltalog
).
decode
(
'
utf-8
'
)
#req_json = last_line.split(': ', maxsplit=1)[1]
#req_json = last_line.split(': ', maxsplit=1)[1]
req_json
=
last_line
.
split
(
'
>>>
'
,
maxsplit
=
1
)[
1
]
req_json
=
last_line
.
split
(
'
>>>
'
,
maxsplit
=
1
)[
1
]
...
@@ -233,11 +235,11 @@ def main():
...
@@ -233,11 +235,11 @@ def main():
log
.
debug
(
'
last line pretty:
'
)
log
.
debug
(
'
last line pretty:
'
)
log
.
debug
(
pprint
.
pformat
(
req
,
indent
=
1
))
log
.
debug
(
pprint
.
pformat
(
req
,
indent
=
1
))
req_start
=
req
[
'
attributes
'
][
'
reqStart
'
][
0
]
req_start
=
req
[
'
attributes
'
][
'
reqStart
'
][
0
]
log
.
info
(
'
continuing from last logged req: {}
'
.
format
(
req_start
))
log
.
error
(
'
continuing from last logged req: {}
'
.
format
(
req_start
))
except
:
except
:
log
.
exception
(
'
error: trying to retrieve last req
'
)
log
.
exception
(
'
error: trying to retrieve last req
'
)
req_start
=
datetime
.
datetime
.
utcnow
().
strftime
(
'
%Y%m%d%H%M%S.%fZ
'
)
req_start
=
datetime
.
datetime
.
utcnow
().
strftime
(
'
%Y%m%d%H%M%S.%fZ
'
)
log
.
info
(
'
using current timestamp: {}
'
.
format
(
req_start
))
log
.
error
(
'
using current timestamp: {}
'
.
format
(
req_start
))
while
True
:
while
True
:
start_time
=
time
.
perf_counter
()
start_time
=
time
.
perf_counter
()
...
@@ -261,7 +263,7 @@ def main():
...
@@ -261,7 +263,7 @@ def main():
req_type
=
entry
[
'
attributes
'
][
'
reqType
'
][
0
]
req_type
=
entry
[
'
attributes
'
][
'
reqType
'
][
0
]
req_dn
=
entry
[
'
attributes
'
][
'
reqDN
'
][
0
]
req_dn
=
entry
[
'
attributes
'
][
'
reqDN
'
][
0
]
log
.
info
(
'
processing: {}
'
.
format
(
entry
[
'
dn
'
]))
log
.
debug
(
'
processing: {}
'
.
format
(
entry
[
'
dn
'
]))
if
req_type
==
'
modify
'
:
if
req_type
==
'
modify
'
:
if
is_skipped
(
entry
):
if
is_skipped
(
entry
):
...
...
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