Regular expression doesnot contain any match

Hi Graylog Team:

[ABX][lie][2021-05-22 10:51:20.277][xxx-thread-10][DEBUG][c.x.g.g.t.rfm.Rfm][275] - xxxx ]

my logs looks like this. And when I use “\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}” as regex expression in following java code, it could extract timestamp 2021-05-22 10:51:20.277

    String logs="[GORAL][lieng][2021-05-22 10:51:20.277][xxx-thread-10][DEBUG][c.x.g.g.t.rfm.Rfm][275] - xxxx ]"
    symbol = "";
    Pattern pattern3 = Pattern.compile("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3}");
    Matcher matcher3 = pattern3.matcher(logs);


    if (matcher3.find()) {
        symbol = matcher3.group();
    }

    log.debug("symbol: {}", symbol);

but when I give this regex in the extractor, it shows me “regular expression doesnot contain any math”
Any suggestions?

Hello, Dreamramon,

I noticed that your post did not receive any responses.  Have you checked out this previous solution to a similar issue.  Please let me know if this help.  Your question is important to the community.

Not yet…Still waiting for the answer …
actually I try my regex in java code above, it returns the text I want to extract. But it doesnot in graylog.

Try to put your regex in parenthesis:
(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3})

its working :slight_smile: thanks very much !!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.