Fervent Coder

Coding Towards Utopia...by Rob Reynolds
posts - 278 , comments - 431 , trackbacks - 0

My Links

News


Rob Reynolds

Subscribe to Fervent Coder RSS
Subscribe to Fervent Coder by Email

About Me

I manage several open source projects. Need...
   ...package management for Windows?
   ...automated builds?
   ...database change management (migrations)?
   ...your application to check email?
   ...a monitoring utility?

I also write for



Like what you are reading? Want to buy me a cup of coffee?
PayPal - The safer, easier way to pay online!

Article Categories

Archives

Post Categories

Sites

BareTail - Log File Monitoring Tool

I just recently started using BareTail (which is a free Tail for Windows) and I have to say it is fantastic at what it does.  What is a tail? In Unix it is used to mean the end of the log file.  The follow (-f) option translates into staying with the bottom, or tail end, of the file.

BareTail is a Log File Monitoring tool that you can leave running all the time and it will refresh file changes without ever locking /BaretailYetAnotherLogTool_12738/screenshot_main_2.gif">screenshot_main

 

· Real-time file viewing

· Follow tail mode

· Tail multiple files

· Configurable highlighting

· International character sets

· Many file formats

· Flexible configuration options and storage

· Single small executable, no installer

Thoughts On BareTail

Did I mention that FREE is one of my favorite 4 letter F words?! There are other tools out there like this that don't perform as well as this tool and they cost much more.  Now being said that it is a free tool, if you find the tool useful, you might think about contributing back to the person that took the time to help you be more productive.  You can register the product for $25.

 

Three really good ideas are incorporated into this product.

  1. No installer required.  Put it where you want and run it. That's awesome.
  2. As Dru says, the best tools get out of your way.  You can leave BareTail running all day and it has a very small footprint.
  3. You can script out the logs you want it to watch by setting up a batch file with the path to each log file after the filename.

Easily Script Out Paths to Log Files

If you call baretail.exe on a command line, you can give it paths to log files as parameters. Instead of doing that every time, you can script out paths in batch files. Below is a simple example of calling baretail.exe with paths to three log files on the same server.

SET SERVER=TEST
SET DIR=\Logs\Applications\
 
START baretail.exe \\%SERVER%%DIR%Application1.Console.log \\%SERVER%%DIR%Application2.Console.log \\%SERVER%%DIR%Application3.log

Notice that I put the server variable as the first line.  For each environment, my paths are exactly the same, so I only have to change the server variable.  Right now I am watching four log files for a set of applications we are creating.  I have four environments and we are in three of them currently. I name the batch files like this: baretail_appName_Environment.bat.

Here is a more advanced sample, where you get log files for your web server from today and tomorrow (UTC anyone?). I started with a batch file but found it to be too flaky on date math and turned to VBS, which handled this very easily.

Option Explicit
 
Function GetLogName(theDate)
    Dim strYear
    Dim strMonth
    Dim strDay
    strYear = Mid(Cstr(Year(theDate)),3)
    strMonth = CStr(Month(theDate))
    strDay = CStr(Day(theDate))
    
    if Len(strMonth) = 1 then
        strMonth="0" & strMonth
    end if
 
    if Len(strDay) = 1 then
        strDay="0" & strDay
    end if
    
    GetLogName="ex" & strYear & strMonth & StrDay & ".log"
End Function
 
 
Dim server
Dim directory
Dim application
server ="serverName"
directory ="\\" & server & "\c$\WINNT\system32\LogFiles\W3SVC1\"
application = "baretail.exe"
 
Dim args
args = ""
 
Dim today
today = DATE
args = args & directory & GetLogName(today) & " "
 
Dim tomorrow
tomorrow = DATEADD("d",1,today)
 
args = args & directory & GetLogName(tomorrow) & " "
 
 
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
 
WshShell.Run application & " " & args, 1, False
Set WshShell = Nothing
 
WScript.Quit

When you run the script you get log files for today and tomorrow. Why would I want tomorrow's date for a log file? Tomorrow because we leave IIS log files to the default UTC time which means it has created a new log file for the next day around 7PM.  If the file doesn't yet exist, there will be a red X instead of a green dot.  That will go away once the file is created and you will be able to watch the logs.

 baretail

When there are changes to a file, the green arrow show up.

baretailCloseup

 

Launchy and BareTail - A Great Combination

Having the batch files available, you can hook it up with Launchy and be even more productive.  I put the BareTail application and batch files in a self-created Launchy applications folder. Then when I want to run baretail, I hit the Hotkey for Launchy (default is Alt+Space), type baretail_ and pick the one from the drop down I want by pressing {Down Arrow} and hitting {Enter}.

baretailLaunchy

 

BareTail - A Great Product

If you find yourself looking at log files, I would say that you will find this product will save you quite a bit of time (between opening and closing and reopening log files to see the changes). I am finding it to be a very useful tool because I am looking at log files quite a bit.  I started using it for watching log files that I never thought to monitor before because it makes it so easy to do now.  BareTail is a delightfully small product that is free and does one simple thing very well, which is exactly how I like my tools.

Get it here:

  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
  •   Short Url: http://wblo.gs/Vjq
  • Print | posted on Friday, May 9, 2008 12:37 AM | Filed Under [ ApplicationsToysOther ]

    Feedback

    Comments are closed.
    Comments have been closed on this topic.

    Powered by: