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
26c8d819
Commit
26c8d819
authored
7 years ago
by
Sven Mäder
Browse files
Options
Downloads
Patches
Plain Diff
Move all logs with attribute output to debug
parent
39107a1f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/deltalogparse.py
+13
-12
13 additions, 12 deletions
bin/deltalogparse.py
with
13 additions
and
12 deletions
bin/deltalogparse.py
+
13
−
12
View file @
26c8d819
...
...
@@ -14,6 +14,7 @@ import lib_path
import
lib
import
dphysldap
# security warning: using DEBUG may log sensitive data
# log levels: CRITICAL | ERROR | WARNING | INFO | DEBUG | NOTSET
# default: WARNING
log_level
=
logging
.
INFO
...
...
@@ -103,7 +104,7 @@ def is_skipped(entry):
for
attribute
in
entry
[
'
attributes
'
][
'
reqMod
'
]:
try
:
if
not
rgx_skip
.
search
(
attribute
):
log
.
info
(
'
interesting attribute: {}
'
.
format
(
attribute
))
log
.
debug
(
'
interesting attribute: {}
'
.
format
(
attribute
))
return
False
except
:
log
.
debug
(
'
caught exception: while checking skipped, assume interesting attribute: {}
'
.
format
(
attribute
))
...
...
@@ -125,14 +126,14 @@ def filtered(entry):
if
type
(
attribute
)
is
bytes
:
is_bytes
=
True
log
.
info
(
'
this is a bytes object, decoding it...
'
)
log
.
debug
(
'
this is a bytes object, decoding it...
'
)
log
.
debug
(
'
encoded: {}
'
.
format
(
attribute
))
decoded
=
attribute
.
decode
(
'
utf-8
'
,
errors
=
'
ignore
'
)
attribute
=
decoded
try
:
if
rgx_filter
.
search
(
attribute
):
log
.
info
(
'
filter attribute: {}
'
.
format
(
attribute
))
log
.
debug
(
'
filter attribute: {}
'
.
format
(
attribute
))
entry
[
'
attributes
'
][
'
reqMod
'
].
remove
(
attribute
)
elif
rgx_redacted
.
search
(
attribute
):
...
...
@@ -147,14 +148,14 @@ def filtered(entry):
log
.
info
(
'
redact attribute: {}
'
.
format
(
redacted
))
else
:
redacted
=
''
.
join
([
key
,
delimiter
])
log
.
info
(
'
redact attribute (nothing to redact): {}
'
.
format
(
redacted
))
log
.
debug
(
'
redact attribute (nothing to redact): {}
'
.
format
(
redacted
))
entry
[
'
attributes
'
][
'
reqMod
'
][
index
]
=
redacted
else
:
log
.
error
(
'
error: matching rgx_attr_key on redacted attribute
'
)
unknown_redacted
=
'
unknownAttribute: [REDACTED]
'
log
.
error
(
'
using: {}
'
.
format
(
unknown_redacted
))
log
.
debug
(
'
using: {}
'
.
format
(
unknown_redacted
))
entry
[
'
attributes
'
][
'
reqMod
'
][
index
]
=
unknown_redacted
elif
is_bytes
:
...
...
@@ -171,19 +172,19 @@ def filtered(entry):
value_base64
=
base64
.
b64encode
(
value_bytes
).
decode
(
'
utf-8
'
)
log
.
debug
(
'
value_base64: {}
'
.
format
(
value_base64
))
half_encoded_base64
=
''
.
join
([
key_delimit
,
value_base64
])
log
.
info
(
'
bytes attribute: {}
'
.
format
(
half_encoded_base64
))
log
.
debug
(
'
bytes attribute: {}
'
.
format
(
half_encoded_base64
))
entry
[
'
attributes
'
][
'
reqMod
'
][
index
]
=
half_encoded_base64
else
:
log
.
warning
(
'
warning: something strange has happened, this should not happen (maybe)
'
)
encoded_base64
=
base64
.
b64encode
(
entry
[
'
attributes
'
][
'
reqMod
'
][
index
]).
decode
(
'
utf-8
'
)
log
.
error
(
'
bytes attribute, using base64 encoding: {}
'
.
format
(
encoded_base64
))
log
.
debug
(
'
bytes attribute, using base64 encoding: {}
'
.
format
(
encoded_base64
))
entry
[
'
attributes
'
][
'
reqMod
'
][
index
]
=
encoded_base64
else
:
log
.
error
(
'
error: matching rgx_attr_key on bytes attribute
'
)
encoded_base64
=
base64
.
b64encode
(
entry
[
'
attributes
'
][
'
reqMod
'
][
index
]).
decode
(
'
utf-8
'
)
log
.
error
(
'
bytes attribute, using full base64 encoding: {}
'
.
format
(
encoded_base64
))
log
.
debug
(
'
bytes attribute, using full base64 encoding: {}
'
.
format
(
encoded_base64
))
entry
[
'
attributes
'
][
'
reqMod
'
][
index
]
=
encoded_base64
except
:
...
...
@@ -214,10 +215,10 @@ def write(entry):
entry
[
'
attributes
'
]
=
dict
(
entry
[
'
attributes
'
])
# debug
entry
[
'
raw_attributes
'
]
=
dict
(
entry
[
'
raw_attributes
'
])
log
.
debug
(
'
original entry:
'
)
log
.
debug
(
pprint
.
pformat
(
entry
,
indent
=
1
))
# debug
ging
#
entry['raw_attributes'] = dict(entry['raw_attributes'])
#
log.debug('original entry:')
#
log.debug(pprint.pformat(entry, indent=1))
filtered_entry
=
filtered
(
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