question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to use regular expression in filter ?

See original GitHub issue

hi all,

I try to using regular expression in my rule as below, it’s will alert when id is 1.1 and msg contain type.24:6

 filter:
 - and:
    - term:
         id: "1.1"
   - query:
        query_string:
            query: "msg:\"Type.[0-9]{1,2}\\:6\""

but it’s cannot alert ,Is it possible to use regular expression in filter ?

Thanks by advance

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
alankiscommented, Nov 9, 2018

@abhishekjiitr What about using complex queries like this one below:

filter:
- query:
    query_string:
      query: "beat.hostname: some.hostname  AND system.process.name: java AND system.process.cmdline: /*java*/ AND system.process.cmdline: /*org\.apache\.spark\.deploy\.master\.Master*/"
      analyze_wildcard: true

I am getting the same error ‘found unknown escape character’.

Edit: Each of reserved characters should be escaped. So the last line should look like this:

filter: 
- query:
    query_string:
      query: "system.process.cmdline: /*org/.apache/.spark/.deploy/.master/.Master/*"
      analyze_wildcard: true
0reactions
Qmandocommented, May 14, 2019

Is field analyzed? If so, you’ll definitely need field.raw or field.keyword. I would have tried option # 1 so if that doesn’t work I can’t help you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use regular expressions in filters and automated rules
Start creating a filter or automated rule. · Select a setting or metric from the + Attribute or metric list. · Select the...
Read more >
Regex Filter transform - IBM
The Regex Filter transform filters messages in the data stream according to a regular expression (regex) pattern, which you can define.
Read more >
4.1 Creating Filters with Regular Expressions
Where available, include and exclude filters can be used independently or together to give you a great deal of control in looking for...
Read more >
How does the Regular Expression (RegEx) filter work?
Our RegEx filter allows you to extract text data from your PDF documents based on regular expression.
Read more >
How to Filter Queries Using Regular Expressions
Regular Expressions are special characters that help search data and match complex patterns using placeholder characters called operators, such ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found