You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> logmine -v "<time>:/\\d{2}:\\d{2}:\\d{2}/" "<router_name>:/router\\d{2}-\\d{1}/" \
"<wifiChannel>:/\\d{4}\\/\\d{2}\\/\\w{2}\\(\\d{2}cBm\\)/"
Traceback (most recent call last):
File "/home/jbfavre/.local/bin/logmine", line 6, in <module>
run()
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/run.py", line 47, in run
return logmine.run(input_files)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/log_mine.py", line 18, in run
clusters = self.processor.process(files)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/processor.py", line 25, in process
return self.process_pipe()
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/processor.py", line 84, in process_pipe
clusterer = Clusterer(**self.cluster_config)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/clusterer.py", line 18, in __init__
self.preprocessor = Preprocessor(variables)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/preprocessor.py", line 16, in __init__
self.variables = [
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/preprocessor.py", line 17, in <listcomp>
(tuple[0], re.compile(tuple[1])) for tuple in parsed_variables
File "/usr/lib/python3.9/re.py", line 252, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.9/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.9/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.9/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 644, in _parse
if not sourcematch("}"):
File "/usr/lib/python3.9/sre_parse.py", line 251, in match
self.__next()
File "/usr/lib/python3.9/sre_parse.py", line 245, in __next
raise error("bad escape (end of pattern)",
re.error: bad escape (end of pattern) at position 5
Wooops… let's try "<wifiChannel>:/\\d{4}\/\\d{2}\/\\w{2}\\(\\d{2}cBm\\)/" (only one \ escape before internal /)
logmine -v "<time>:/\\d{2}:\\d{2}:\\d{2}/" \
"<router_name>:/router\\d{2}-\\d{1}/" \
"<wifiChannel>:/\\d{4}\/\\d{2}\/\\w{2}\\(\\d{2}cBm\\)/"
Traceback (most recent call last):
File "/home/jbfavre/.local/bin/logmine", line 6, in <module>
run()
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/run.py", line 47, in run
return logmine.run(input_files)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/log_mine.py", line 18, in run
clusters = self.processor.process(files)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/processor.py", line 25, in process
return self.process_pipe()
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/processor.py", line 84, in process_pipe
clusterer = Clusterer(**self.cluster_config)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/clusterer.py", line 18, in __init__
self.preprocessor = Preprocessor(variables)
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/preprocessor.py", line 16, in __init__
self.variables = [
File "/home/jbfavre/.local/lib/python3.9/site-packages/logmine_pkg/preprocessor.py", line 17, in <listcomp>
(tuple[0], re.compile(tuple[1])) for tuple in parsed_variables
File "/usr/lib/python3.9/re.py", line 252, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.9/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.9/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.9/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 644, in _parse
if not sourcematch("}"):
File "/usr/lib/python3.9/sre_parse.py", line 251, in match
self.__next()
File "/usr/lib/python3.9/sre_parse.py", line 245, in __next
raise error("bad escape (end of pattern)",
re.error: bad escape (end of pattern) at position 5
Nope, doesn't work either…
Let's go without any escape before internal /:
Cool, it works !
But…wait a minute… if I do not escape internal /, how does Python knows it's not the end of the regexp ?
More: I'm looking for 4 digits followed by / then 2 digits followed by / then 2 letters.
So, how is it that 5180/20-Ceee/ac/P could ever match and get replaced?
Thanks in advance for the explanation, I'm stuck here 🤔
The text was updated successfully, but these errors were encountered:
👋
First, thanks for the tools, it's very useful.
However, I'm facing a quite strange behaviour with variables.
Let say I've logs like:
And I want to use variables to get:
Let's start with
time
as in the README file:Cool, let's add
router_name
:Great. Now, add
wifiChannel
:Wooops… let's try
"<wifiChannel>:/\\d{4}\/\\d{2}\/\\w{2}\\(\\d{2}cBm\\)/"
(only one\
escape before internal/
)Nope, doesn't work either…
Let's go without any escape before internal
/
:Cool, it works !
But…wait a minute… if I do not escape internal
/
, how does Python knows it's not the end of the regexp ?More: I'm looking for 4 digits followed by
/
then 2 digits followed by/
then 2 letters.So, how is it that
5180/20-Ceee/ac/P
could ever match and get replaced?Thanks in advance for the explanation, I'm stuck here 🤔
The text was updated successfully, but these errors were encountered: