You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by "Dima Kovalyov (Jira)" <ji...@apache.org> on 2020/01/10 01:51:00 UTC

[jira] [Created] (METRON-2339) Can not match backslash in REGEXP_MATCH Stellar REPL

Dima Kovalyov created METRON-2339:
-------------------------------------

             Summary: Can not match backslash in REGEXP_MATCH Stellar REPL
                 Key: METRON-2339
                 URL: https://issues.apache.org/jira/browse/METRON-2339
             Project: Metron
          Issue Type: Bug
    Affects Versions: 0.7.1
         Environment: centos 7
            Reporter: Dima Kovalyov


If I have a message with a backslash like C:\Windows
How can I use REGEXP_MATCH to Profile this message?

Here is where it does not work for me. I have a message:
{code:java}
{
  "line": "test"
} {code}
To keep it simple this is just text with no special characters.

Using Stellar REPL I create the following profile:
{code:java}
{
    "profiles": [{
            "profile": "match-backslash",
            "foreach": "line",
            "onlyif": "REGEXP_MATCH(line, '\\')",
            "init":   { "count": "0" },
            "update": { "count": "count + 1" },
            "result": "total"
            }
    ]
} {code}
Here is what happens when I apply any message:
{code:java}
[Stellar]>>> PROFILER_APPLY(msg, profile)
2020-01-09 18:24:26 ERROR DefaultMessageRouter:123 - error while executing profile; profile='match-backslash', error='Unable to parse: REGEXP_MATCH(line, '\') due to: Syntax error @ 1:26 no viable alternative at input 'REGEXP_MATCH(line,'''
org.apache.metron.stellar.dsl.ParseException: Unable to parse: REGEXP_MATCH(line, '\') due to: Syntax error @ 1:26 no viable alternative at input 'REGEXP_MATCH(line,'' {code}
If I escape more:
{code:java}
{
    "profiles": [{
            "profile": "match-backslash",
            "foreach": "line",
            "onlyif": "REGEXP_MATCH(line, '\\\\')",
            "init":   { "count": "0" },
            "update": { "count": "count + 1" },
            "result": "total"
            }
    ]
} {code}
I'll get this:
{code:java}
[Stellar]>>> PROFILER_APPLY(msg, profile)
2020-01-09 18:11:31 ERROR DefaultMessageRouter:123 - error while executing profile; profile='profiler_test', error='Unable to parse: REGEXP_MATCH(line, '\\') due to: Unexpected internal error near index 1
\ with relevant variables line=test'
org.apache.metron.stellar.dsl.ParseException: Unable to parse: REGEXP_MATCH(line, '\\') due to: Unexpected internal error near index 1
\ with relevant variables line=test {code}
 

METRON-1922 - this does not affect me
METRON-2002 - this might be relevant



--
This message was sent by Atlassian Jira
(v8.3.4#803005)