How to Tail a Log File

Tail a Log File on Windows & Linux

Matt Watson Developer Tips, Tricks & Resources, Popular Leave a Comment

It turns out there are a bunch of people on StackOverflow looking for ways to tail a log file, but there don’t appear to be many resources for all the different tips and tools to do this. If you’re a Java or .NET developer, just getting started with tailing log files, or a seasoned developer who needs something quick and easy to set up and go, there are several options. In fact, there may be too many.

No worries, no SPAM. Opt-out anytime.

Check out some tools I found that make tailing a log file a walk in the park. Tailing multiple log files? Want to tail logs remotely from a web browser? This list covers a whole array of needs.

 

The Standard Linux Tail Command

The de facto standard for linux systems is the ever-handy “tail” command. Need I say more?

$ tail -f /var/log/syslog -f /var/log/myLog.log

  • Quick and easy
  • No additional installation required
  • Can be used with multiple –f filenames in the same window as shown in the script example above
  • Unix only. See Tail for Win32 at the bottom of this post for a port to Windows.

less -F

Less +F

Brian Storti (@brianstorti) offers an alternative method to the standard tail -f: less +F, which causes similar behavior as tail -f but allows for easily switching between navigation and watching mode. However, he notes that if you need to watch multiple files simultaneously, the standard tail -f offers better output.

  • Easy to use
  • Creates behavior comparable to tail -f
  • Allows for easy switching between navigation and watching mode
  • Not ideal for watching multiple files simultaneously

 

Windows Powershell

Windows Powershell

Powershell is one of the most overlooked windows apps for ops. This approach doesn’t have any extra features but can be perfect for opening a quick commandlet window and keeping an eye on the status of a file.

Use the following simple syntax to show the tail end of a log file in real-time.

Get-Content myTestLog.log –Wait

You can also filter the log right at the command line using regular expressions:

Get-Content myTestLog.log -wait | where { $_ -match “WARNING” }

  • Quick and easy to get going
  • Practically zero learning curve
  • No additional installation necessary for newer windows machines
  • Requires Windows Powershell (duh!)
  • Slow for large files
  • Basic functionality but some 3rd party extensions are available. For example, you need multiple cmdlet windows to monitor multiple files
  • How-To Geek provides a step-by-step tutorial for getting tail-like functionality with Powershell that you may find useful.

 

Stackify Tail a Log

Stackify’s Retrace

Retrace is an APM tool that provides all the support you need to monitor and optimize your applications, including enhanced log management which fully indexes and tags your logs.  Retrace also tails log files in real-time.

  • Remotely tail log files via web browser
  • Search all log files, including iis logs
  • See how log files are trending and monitor specific logs
  • Supported for Windows & Linux systems
  • Free trial, low monthly cost

 

The best log viewer for developers in the universe


 

Vim log file tailing

Vim (Using Tail Bundle Plugin)

Developed by Martin Krischik (@martin_krischik), this handy-dandy plugin for Vim allows you to use “the best tail plugin you can get.”

  • Vim die-hards can tail log files without ever leaving their favorite editor!
  • Multiple file tailing using tabs
  • “Preview” window updated according to your Vim usage
  • Read the open issues on the Google Code page before installing
  • Check out Krischik’s other projects here

Emacs

Emacs

To tail a file in Emacs (@emacs): start Emacs, hit M-x (Alt and x keys together), and type “tail-file”. Then, enter the filename to tail. The net result is that this will spawn an external tail -f process. Emacs is much more than a tool for tailing log files, however; it’s packed with other features and functionality ranging from project planning tools to debugging, a mail and news reader, calendar, and more.

  • Customizable using Emacs Lisp code or a graphical interface
  • Packaging system for downloading and installing extensions
  • Unicode support for nearly all human scripts
  • Built-in documentation
  • Tutorial for new users
  • Content-aware editing modes including syntax highlighting

 

Multitail for UNIX log files

MultiTail

Developed by Folkert van Heusden (@flok99), MultiTail was inspired by wtail, which was written by André Majorel. This is one of the more complete UNIX offerings, in my humble opinion. It’s a relatively newer tool compared to some others on this list, with a stable version released in February 2015.

  • Uses wildcard matching to see if a more recently spawned logfile needs to be monitored
  • Uses regular expressions for filtering
  • Source code available in public Github repository
  • All major UNIX platforms supported

 

BareTail log tailing for Windows

BareTail

Developed by Bare Metal Software, BareTail is a free tool for monitoring log files in real-time. The “Bare” in the name might prompt some to ask, “How can you get any barer than regular Tail?” It turns out the name is a carryover from the software development group that built it, and this tool provides a color-coded GUI above and beyond good ‘ole Unix Tail.

  • Developed for Windows
  • Monitors multiple files using tabs
  • Configurable highlighting
  • Allows instant scrolling to any point in the file, even for large files
  • Free version available; a registered license is $25. There’s also a BareTailPro, which is packed with even more features and offers a free demo.

LogTail

LogTail

Developed by John Walker of Fourmilab (@Fourmilab), this tool doesn’t appear to have been supported in a long time (the website is dated 1997) and may not play well with the latest distros of Unix. You have been warned.

  • Allows you to monitor multiple log files on multiple servers at once
  • Automatically checks if the monitored process has spawned a fresh log file and adjusts monitoring accordingly
  • Old script (circa 1997) may not play well with newer Unix distros/Perl patches (built withi Perl 4.0, patch level 36)
  • UNIX only

 

TraceTool error logging

TraceTool

Developed by Thierry Parent, TraceTool is a great option for .NET developers needing to build their own log tailing feature. The code comes with a lot of power and features, but it might not be as good a choice if you simply want to run a quick program and be off on your merry way. You can also check it out on SourceForge.

  • Powerful tool with lots of customizability via code.
  • There is a learning curve, depending on how far you want to take TraceTool. Check out the “TraceTool Overview” screenshot on the CodeProject page and you’ll see what I mean.
  • Not a quick fix. If you simply want to open a quick executable and see the tail of a few log files, pick something else. This will take you some time to set up and get configured.
  • With great power comes great responsibility. The CodeProject discussion section has comments from users experiencing several different kinds of problems. Yet despite any problems users have, they consistently ranked the page highly, with an average vote of 4.97 at the time of this writing.
  • Source code is readily available for download, but you’ll need a .NET development environment setup to compile it.
  • Windows only.

 

SnakeTail

SnakeTail.net

SnakeTail.net is developed by SnakeNest. Looks can be deceiving – I thought this Google Project was long dead but was pleasantly surprised that bugs are still being fixed and features added as recently as September 2016.

  • Low memory & CPU footprint even with large files
  • Customizable shortcut keys to jump around files quickly
  • Can tail a log directory where the latest log files are stored
  • Windows only

 

image_thumb

Notepad++

Hardcore fans of Notepad++ (@Notepad_plus) often like to work in it all day, every day. Now you can tail a log file in Windows without ever leaving Notepad++ by using the Document Monitor plugin (granted – hardcore fans probably already know all about this!):

  1. Open Notepad++ then from the top menu select “Plugins > Plugin Manager > Show Plugin Manager,” then check the option for “Document Monitor,” then click “Install.”
  2. Notepad++ will prompt you to restart the program (not restart your computer).
  3. Upon opening Notepad++ again, select “Plugins” and you should now see the “Document Monitor > Start to monitor” option. This will refresh the view of your document automatically every 3 seconds.

 

image_thumb_11

inotail

Developed by Tobias Klauser (@t_klauser), inotail is a basic tool with minimal options compared to the others on this list. But for those of you yearning for simplicity, this just might be the log tail tool you’re looking for. The most recent update, however, is from back in 2009, and the most recent version, inotail 0.5, was released in 2007.

  • Git and GitHub repos available
  • Uses the inotify API to determine if a file needs to be reread

 

tail windows log files

Tail for Win32

Developed by Paul Perkins, Tail for Win32 is a Windows version of the UNIX ‘tail’ command, providing a quick and dirty way to use the Unix Tail command you’re used to on Windows systems. Many folks might consider this completely unnecessary on a windows system with the prevalence of Powershell these days, but it does provide a couple nice features you wouldn’t otherwise have:

  • Highlighted keyword matching
  • Can send email notifications via SMTP or MAPI when keywords are found
  • The ability to watch multiple files in real-time simultaneously
  • Can process files of any size on both local and networked drives
  • Download Tail for Win32 on SourceForge

 

JLogTailer

JLogTailer

JLogTailer is a Java log tailer with regular expression features that makes it possible to view any log file entries in real-time. It’s an easy-to-use tool that’s helpful when you need to see what’s going into the end of your log files as it happens while you tinker with your code. Additionally, you can use JLogTailer to tail multiple log files if needed.

  • View log entries in real-time
  • Simple to use
  • Works for tailing multiple log files

WebTail

WebTail

With so many programs generating log files, other tools are useful when you have direct access to the file system that stores each log. But what if you don’t have direct access to your log file? That’s where WebTail comes in, enabling you to tail any log file that can be viewed via a web server. In addition to allowing you to view entries the moment they’re appended to log files, WebTail requires less bandwidth than you’d otherwise use to download the entire file several times.

  • Useful for tailing log files stored on web servers
  • Save bandwidth by eliminating the need to download complete files multiple times
  • Tail any log file viewable via a web server

MakeLogic

MakeLogic Tail

An advanced tail -f command with GUI, MakeLogic Tail is the tail for Windows. It can be used to monitor the log files of various servers and comes with a variety of other intuitive and useful features.

  • Shows the last several lines of growing log files
  • Real-time monitoring
  • Requires JRE 5.0
  • Easy to use GUI
  • Search current and all open log files
  • Highlight select keywords in various colors
  • Monitor most recently opened documents
  • Cascade or Tile the log file windows

Wintail

Wintail

Wintail is a free program created by Andy Hofle after he struggled with viewing log files in real-time with Windows Notepad. There was no program like tail -f in UNIX for Windows at the time, so he wrote his own. It’s a useful tool enabling you to have multiple tiled windows open simultaneously, and you can also pause updates to examine files more closely when needed.

  • Supports large files over 2GB
  • Error highlighting
  • Drag-and-drop files you wish to monitor into the title or menu bar to open them
  • Create shortcuts to frequently-monitored files
  • Added support for Windows Server 2012 in November 2015

LogExpert

LogExpert

If you’re looking for an intuitive, easy-to-use tail application for Windows, LogExpert is a solid option offering search functionality, bookmarking, filter views, highlighting, time stamps, and other useful features that make monitoring a less frustrating task.

  • Search functions including RegEx
  • Flexible filter view
  • Columnizers
  • Highlight lines using search criteria
  • Supports Unicode, SFTP, log4j XML files, and third-party plugins
  • Plugin API for more log file data sources

glogg

glogg

A multi-platform GUI application for browsing and searching through long, complex log files, glogg can be described as a graphical, interactive combination of grep and less. An open-source tool released under the GPL by Nicolas Bonnefon, glogg functions on both Windows and Mac, making it a functional tool for any developer.

  • Use regular expressions to search for events in log files
  • Designed to help you spot and understand problems in the massive logs generated by embedded systems
  • Also useful for sysadmins searching through logs on databases or servers
  • Second window shows results from the current search
  • Supports grep/egrep like regular expressions
  • Colorizes logs and search results
  • Follows logs written to a disk in real-time

 

I’d love to hear about your go-to methods for tailing log files on Windows, so share your favorite tips and tools below.

 

About Matt Watson

Matt is the Founder & CEO of Stackify. He has been a developer/hacker for over 15 years and loves solving hard problems with code. While working in IT management he realized how much of his time was wasted trying to put out production fires without the right tools. He founded Stackify in 2012 to create an easy to use set of tools for developers.