Giter Site home page Giter Site logo

Comments (4)

davidohana avatar davidohana commented on July 21, 2024

Can you provide a sample regex with the problem and the stack trace of the error?

from drain3.

lucasfersil avatar lucasfersil commented on July 21, 2024

Sure, although it can be a typo of mine:

{"regex_pattern":"((?<=C\\=\\").*(?=\\"))", "mask_with": "SENTMSG"}

it leads to:

Traceback (most recent call last):
File "drain3_ex.py", line 43, in
template_miner = TemplateMiner(persistence)
File "/root/venvdrain/lib64/python3.8/site-packages/drain3/template_miner.py", line 32, in init
self.masker = LogMasker()
File "/root/venvdrain/lib64/python3.8/site-packages/drain3/masking.py", line 55, in init
m = json.loads(config.get('DEFAULT', 'masking', fallback="[]"))
File "/usr/lib64/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 7 column 31 (char 578)

But it works correctly using single escape on double quotes:

{"regex_pattern":"((?<=C\\=\").*(?=\"))", "mask_with": "SENTMSG"}

from drain3.

davidohana avatar davidohana commented on July 21, 2024

I think that your regex pattern is illegal. The " in \" is treated as the end of regex_pattern json string.
Maybe you meant to do: {"regex_pattern":"((?<=C\\=\\\").*(?=\\\"))", "mask_with": "SENTMSG"} ?

from drain3.

lucasfersil avatar lucasfersil commented on July 21, 2024

"((?<=C\\=\\\").*(?=\\\"))"
and
"((?<=C\\=\").*(?=\"))"

are working, it's just more difficult to read than traditional LogPai implementation due to many back slashes.

from drain3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.