Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

How to get the last n lines of a text file ("tail -n log.file")

avatar
Contributor

Hi,

 

An external process creates an error.file on certain events and updates the process log file.

 

The process that I'm creating starts when the error.file is created and need to read the last 10 - 15 lines of the log.file. My problem is that the log.file does not rollover and just grows continually and neither follows a log standard in order to use SysLog processors.

 

How can I get that last 10 - 15 lines of the log file? Something like ( "tail -15 log.file" ).

 

Thanks in advance.

1 ACCEPTED SOLUTION

avatar
Super Guru

Hi @templarian ,

 

You can use something like the example below:

araujo_0-1648594388252.png

 

araujo_1-1648594412531.png

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

View solution in original post

2 REPLIES 2

avatar
Super Guru

Hi @templarian ,

 

You can use something like the example below:

araujo_0-1648594388252.png

 

araujo_1-1648594412531.png

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

avatar
Contributor

Hi André,

 

That is what I needed. Thanks a lot.

 

For those who are facing the same problem in windows; @araujo's solution also works with Powershell

 

Nifi ExecuteStreamCommand Powershell.png