Skip to content

Grok type not working #29

Description

@pchakour

Hello,

I'm trying to use the grok-js module with the following pattern :
%{TIMESTAMP_ISO8601:date} \| %{IP:client} \| %{WORD:method} \| %{URIPATHPARAM:request} \| %{NUMBER:bytes:int} \| %{NUMBER:duration:int}

and the following line :
2018-04-11 15:26:04.756 | 192.168.0.19 | GET | /uri | 18 | 2

Unfortunately, the module doesn't work with types. If I change the pattern like this
%{TIMESTAMP_ISO8601:date} \| %{IP:client} \| %{WORD:method} \| %{URIPATHPARAM:request} \| %{NUMBER:bytes} \| %{NUMBER:duration}

Everything works.

So to fix this issue, I had to change the subPatternsRegex

From

 const subPatternsRegex = /%\{[A-Z0-9_]+(?::[A-Za-z0-9_]+)?\}/g;

To

const subPatternsRegex = /%\{[A-Z0-9_]+(?::[A-Za-z0-9_]+)?(?::[a-z]+)?\}/g;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions