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.

Add validation of custom grok patterns file

See original GitHub issue

Context

The support of custom grok patterns was added in #15

Just add the directory with name Patterns and a file (the file name doesn’t matter) with your own patterns.

Like Patterns\grok-custom-patterns:

ZIPCODE [1-9]{1}[0-9]{2}\s{0,1}[0-9]{3}

and use:

Grok grok = new Grok("%{ZIPCODE:zipcode}:%{EMAILADDRESS:email}");
var grokResult = grok.Parse($"122001:Bob.Davis@microsoft.com");

IndexOutOfRangeException

There is an issue when that custom file has the wrong content.

How to reproduce

Add to the Patterns\grok-custom-patterns the following data:

pattern

How to fix

Add some validation on load of custom grok file content. It should be pattern name, space, then the regexp for that pattern

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ManasviGoyalcommented, Aug 4, 2021

Hi @ManasviGoyal, are you still working on that?

I am busy with some work this month. You can can assign it someone else. No issue with me.

0reactions
Marusykcommented, Aug 22, 2021

Hi @MazixM and @GioMaz, Thanks for your interest. You need to create a Pull Request with changes. Then we can choose the best one

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grok Custom pattern file - Logstash
Hi guys, I'm starting in logstash's world and i'm having a problem to set more than one custom grok pattern into a "patern_dir"...
Read more >
Tutorial: Logstash Grok Patterns with Examples
With the Grok Debugger, we can copy and paste the example log line in the first “Input” field and the Grok filter in...
Read more >
Using field as input to Logstash Grok filter pattern
The answer is no -- the grok filter compiles its pattern when the filter ... :validate => :boolean, :default => false # Append...
Read more >
Writing custom classifiers - AWS Glue
AWS Glue provides many common patterns that you can use to build a custom classifier. You add a named pattern to the grok...
Read more >
How To Use Custom Patterns On Grok Filter For Logstash ...
In order to add new patterns we will need to create a new file. The way we are going to do it is...
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