- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to get the last n lines of a text file ("tail -n log.file")
- Labels:
-
Apache NiFi
Created ‎03-29-2022 12:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎03-29-2022 03:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @templarian ,
You can use something like the example below:
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.
Created ‎03-29-2022 03:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @templarian ,
You can use something like the example below:
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.
Created ‎03-31-2022 10:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
