Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

ExtractGrok processor - Writing Regex to parse Cisco syslog

Solved Go to solution
Highlighted

ExtractGrok processor - Writing Regex to parse Cisco syslog

New Contributor

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

Accepted Solutions

Re: ExtractGrok processor - Writing Regex to parse Cisco syslog

New Contributor

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

4 REPLIES 4

Re: ExtractGrok processor - Writing Regex to parse Cisco syslog

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

Re: ExtractGrok processor - Writing Regex to parse Cisco syslog

New Contributor

@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?

Re: ExtractGrok processor - Writing Regex to parse Cisco syslog

New Contributor

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

Re: ExtractGrok processor - Writing Regex to parse Cisco syslog

New Contributor

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