Skip to main content
hegdemahendra
Gold ⭐️⭐️
Aug 4, 2021 4:36 PM UTC
Solved

What is best way to read nifi logs and put in MongoDb ?

Hello Experts,

 

I have a requirement where nifi flows imp log information should be written to MongDB, so that another application can read mongodb and display those interesting logs info on web UI.

 

I am looking for best way to do this.

One way I am thinking of is tail nifi log (using tail file processor) and filter for imp log and put into MongoDb using native processor.

 

Please suggest if any other better approaches,

thanks in advance.

 

Thanks

Mahendra

Green_
Green_Answer
Gold ⭐️⭐️
Aug 5, 2021 6:08 AM UTC

@hegdemahendra 

Filtering like that in nifi could work though it might be a bit resource intensive depending on the logs. 

Might be worth checking out a different tool specifically designed for handling logs. I've written logs to elasticsearch using logstash in the past,  perhaps it could also work for writing to a mongodb. 

5 replies

Green_
Gold ⭐️⭐️
Aug 4, 2021 7:44 PM UTC

Your approach sounds perfectly reasonable if you only plan to use native nifi tools. I didn't fully understand what kind of filtering you meant, but simply reading the logs with the TailFile processor and sending them to mongo with the PutMongo processor sounds like it would work for your use-case.

Translate
hegdemahendra
Gold ⭐️⭐️
Aug 5, 2021 5:43 AM UTC

@Green_  Filtering means I may need to ignore some INFO level logs and consider only DEBUG or ERROR level logs... and I dont have to be using native nifi processors only.. but right way of doing is importtant.

Please suggest if you see an other way

Translate
Green_
Green_Answer
Gold ⭐️⭐️
Aug 5, 2021 6:08 AM UTC

@hegdemahendra 

Filtering like that in nifi could work though it might be a bit resource intensive depending on the logs. 

Might be worth checking out a different tool specifically designed for handling logs. I've written logs to elasticsearch using logstash in the past,  perhaps it could also work for writing to a mongodb. 

Translate