Two Guys Arguing

Pro Tips: Color Your Tail With Perl

Posted in java, linux by benjaminplee on 03.22.11

We ran into a situation today where our JEE server was logging everything twice.  Sadly, this meant that errors and warnings were logged as INFO and were missed.

2011-03-22 11:40:40,884 INFO  [STDOUT] (main) 11:40:40,884 WARN [ProcessRoles] Could NOT find role XXXX

Since we watched the logs most often using the tail command, the quick and dirty solution was to have tail output lines containing WARN/ERROR/SEVERE in different colors that would stand out as the scrolled past.  The bash/perl script below is the fruit of my hacking.  Suggestions for improvements welcome.

t() {
tail -100f $1 | perl -pe 's/^.*SEVERE.*$/\e[1;37;45m$&\e[0m/g' | perl -pe 's/^.*ERROR.*$/\e[1;37;41m$&\e[0m/g' | perl -pe 's/^.*WARN.*$/\e[1;33;40m$&\e[0m/g'
Tagged with: , , , ,

starting in the box

Posted in configuration, linux by youngnh on 05.19.09

So how does this thing work? Well, it runs on a Dell Optiplex I keep under my desk.

I run Fedora 10 on my day-to-day laptop and absolutely love it. That’s why, after months of collecting dust (and a few very short weeks of running MINIX, but that’s another post) I popped the Fedora 10 LiveCD into my Optiplex’s drive and…waited. If I was dead-set on Fedora, I would still be waiting today because, for some reason, the LiveCD never finished loading.

My box being as old as it is, I took a stab in the dark and guessed that my hardware just wasn’t up to par with the latest Fedora drop. Shame.

This was around the turn of the year, and at that same time a group of very bright gentlemen that I work with had resolved to learn Haskell. Following along, I dove into the Haskell community a bit and became very impressed with the things that Haskellers had to say about Arch Linux. I burned a quick CD, installed it and played around with it a bit.

The Arch Linux LiveCD isn’t anything fancy. The more time I spend on my laptop, though, the more I find myself shutting things off or disabling notifications or swearing at software when I find I can’t do either. My tastes run towards the simple and substantive. Software is one thing I feel that, with increase in quality, should decrease in weight.

Arch Linux starts you off very low to the ground. The full install doesn’t even give you X11, much less a Desktop or windows or Minesweeper, which is disorienting. One thing that delighted me, however, was that it set me up with the filesystem of my choice, XFS. I remember very sharply that Fedora did not give me the option to install the XFS file system out of the box.

My daily programming touches maybe 10-20 userspace programs and I installed those about as quickly as I could think of them. With a package manager, though, it makes great sense to me to only install the programs I need when I need them. Anything else is just taking up space and processor that it doesn’t need to.

Beyond that, Arch Linux’s wiki was an invaluable and easily navigable resource. I spent about 12 hours over one weekend setting up my box. My final effort was installing stumpwm. In 12 hours of installing and configuring, it was the first program that gave me a wince of trouble. Turns out, though, that there was an active forum post on the Arch Linux forums that night discussing the very problems I was having. A few posts later and I not only had a sweet, minimal, emacs-like window manager installed, but I felt like I had left behind some advice useful to anyone who might follow in my footsteps.

After the Arch Linux installation, I had a CouchDB instance and sbcl to run my imagined lisp scraper. I just needed to (1) make my box visible to the internets and (2) fill it up with data.

Tagged with: , , ,