how did you fix the problem i'm using the drain code drain from logpai for parsing logs for anomaly detection and i'm stuck in the same problem . raw input : 081109 203615 148 INFO dfs.DataNode$PacketResponder: PacketResponder 1 for block blk_38865049064139660 terminating the error: splitter = re.sub(" +", "\\\s+", splitters[k]) Processed 100.0% of log lines. --------------------------------------------------------------------------- error Traceback (most recent call last) <ipython-input-20-29577b162b2c> in <cell line: 0>() 21 log_format, indir=input_dir, outdir=output_dir, depth=depth, st=st, rex=regex 22 ) ---> 23 parser.parse(log_file_all) 24 25 ## run on complete dataset 10 frames /usr/lib/python3.11/re/_parser.py in parse_template(source, state) 1085 except KeyError: 1086 if c in ASCIILETTERS: -> 1087 raise s.error('bad escape %s' % this, len(this)) from None 1088 lappend(this) 1089 else: error: bad escape \s at position 0 example of expected output : LineId Date Time Pid Level Component Content EventId EventTemplate ParameterList 1 081109 203615 148 INFO dfs.DataNode$PacketResponder PacketResponder 1 for block blk_38865049064139660 terminating dc2c74b7 PacketResponder <> for block <> terminating ['1', 'blk_38865049064139660'] i tried : splitter = re.sub(r" +", r"\\s+", splitters[k]) splitter = re.sub(' +', '\\\s+', splitters[k]) splitter = re.sub(' +', '\\s+', splitters[k]) splitter = re.sub(' +', '\s+', splitters[k]) they all caused the same error : Processed 100.0% of log lines. --------------------------------------------------------------------------- error Traceback (most recent call last) <ipython-input-2-29577b162b2c> in <cell line: 0>() 21 log_format, indir=input_dir, outdir=output_dir, depth=depth, st=st, rex=regex 22 ) ---> 23 parser.parse(log_file_all) 24 25 ## run on complete dataset 10 frames /usr/lib/python3.11/re/_parser.py in parse_template(source, state) 1085 except KeyError: 1086 if c in ASCIILETTERS: -> 1087 raise s.error('bad escape %s' % this, len(this)) from None 1088 lappend(this) 1089 else: error: bad escape \s at position 0 Continue reading...