Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

ExtractGrok processor - Writing Regex to parse Cisco syslog

avatar

I am running the Nifi on Docker. Nifi ParseSyslog fails for Cisco syslog, so trying to write custom regex parsing using Extract Grok processor.

What is the Grok pattern file to be provided? I provided Grok expression, but it still looks for Grok pattern file.

Any pointers on this will help. Thanks!

1 ACCEPTED SOLUTION

avatar

I got the pattern file created and used in Nifi.

I am using this in grok expression:

<(?<priority>[0-9]+)>(?<sequence>[0-9]+): *(\*)?%{CISCOTIMESTAMP}: (?<host>[a-zA-Z0-9_]+): %(?<facility>[A-Z0-9_]+)-(?<severity>[0-7]+)-(?<mnemonic>[A-Z0-9_]+): (?<message>.+)

grok pattern file - https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-proce...

This expression works fine on Grok debugger site - http://grokdebug.herokuapp.com/. But not on Nifi. What am i doing wrong?

Sample cisco router log data i am using:

<189>22: *Apr 29 13:58:40.411: user: %SYS-5-CONFIG_I: Configured from console by console

View solution in original post

5 REPLIES 5

avatar

Hi Jay,

You need to provide a file such as

https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-proce...

You could also use the ConvertRecord processor with a GrokReader. In this case there is already a default pattern file pre-loaded with the reader.

Hope this helps,

Pierre

avatar

@Pierre Villard - Thanks for the reply. I looked at this pattern file. But I am not sure how to link this file to Grok pattern file on nifi.

I am running it on docker compose, so how do i store this pattern file and what path to provide in the Nifi?

avatar

I got the pattern file created and used in Nifi.

I am using this in grok expression:

<(?<priority>[0-9]+)>(?<sequence>[0-9]+): *(\*)?%{CISCOTIMESTAMP}: (?<host>[a-zA-Z0-9_]+): %(?<facility>[A-Z0-9_]+)-(?<severity>[0-7]+)-(?<mnemonic>[A-Z0-9_]+): (?<message>.+)

grok pattern file - https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-proce...

This expression works fine on Grok debugger site - http://grokdebug.herokuapp.com/. But not on Nifi. What am i doing wrong?

Sample cisco router log data i am using:

<189>22: *Apr 29 13:58:40.411: user: %SYS-5-CONFIG_I: Configured from console by console

avatar

I got it working. I had to add the custom naming fields used in the Grok expression into the pattern file.

avatar
Explorer

Hi, can you explain how did you solve this problem?