Archive for the 'technology' Category

Hey Mister, You’re Gonna Have to Rewrite that Web App

Wednesday, September 19th, 2007

Good old blogger Joel Spolsky just wrote a great overview of the state of web applications. I’m inclined to agree with his prediction, that we’re still in the midst of evolving the technology in web apps. On the desktop all apps have a consistent look and behavior but web apps have their own unique and different user interfaces. On the desktop you can copy and paste between apps, but not on the web except for a few words of text. I wonder how many years it will take for web apps to reach the level of design stability that desktop apps enjoy…

Vernor Vinge’s Technology Predictions in Rainbows End

Wednesday, July 19th, 2006

Vernor Vinge is one of my favorite sci-fi authors. I just read his new book, Rainbows End, and I highly recommend it. It’s set in the near term future (within 20 years), and it has a bunch of technological and social predictions I want to list here since I can’t find them on the Internet (Vinge has a 50 min podcast available which discusses some of them). These aren’t plot spoilers, but they are technology spoilers, so don’t read this if you plan on reading the book:

  • Affiliances - These are some kind of part-time work / large-scale special purpose corporations. I think the great idea here is that with the right software and network infrastructure, it should be possible to break down problems into arbitrarily small sub-problems which can be outsourced to other people anyplace in the world.
  • Belief Circles - This is directed online communities on steroids. This is when online communities which have a common belief system (say fans of Harry Potter, Trekkies, etc.) spend so much time together online that they are able to accomplish things in the real world too.
  • SHE (Secure Hardware Environment) - Following the trends of many modern governments to control encryption and other advanced or threatening technologies, the ultimate dream of government control freaks is that all computing hardware must be regulated by the government. And this government regulation requires that the lowest level computing infrastructure gives back door access to the government to everything that takes place in computers.
  • Localizers - Imagine very cheap wireless sensing machines the size of a grain of sand (something like this but smaller). And if they’re really cheap, and they’re scattered in every square meter around the country, then you’ve got ubiquitous high-bandwidth networking to everybody everywhere. But bye-bye privacy.
  • Contact lens overlays - The idea is that you can change what you see through your eyes with your contact lens (but in his podcast he says he might change it to retinal implants). Instead of painting your house, just have everyone in your family use the same color overlay!
  • SM (Silent Messaging) - People can send instant messages to others without talking or typing — I think the idea is that someone growing up using advanced computer interfaces would be able to interact with their computer interfaces without explicit or at least viewable muscle movements. Wouldn’t this just be technological telepathy?
  • Large Teams Acting as One Giant Brain - What if you had high bandwidth and productive communication between all of your team members, and the team members were experts in a large range of areas, wouldn’t the whole team acting together seem like one god-like intelligence?
  • Friends of Privacy - This is some group of unknown people on the Internet who publish subtle and not-so-subtle lies to make it difficult to trust the information you read about people online. In other words, anonymously-published large-scale disinformation.
  • YGBM (You Gotta Believe Me) - This is technology that let’s you manipulate people’s minds through broadcast media. I think it’s probably possible to control people, look at cult leaders for an example.
  • Ubiquitous Support - Imagine a real-time Google Answers. Imagine if you’re a programmer and you’ve just spent 2 days stuck on a problem, what if you could, immediately and in real-time, pay to get one hour of help from some expert programmer somewhere in the world?

How to Rotate Apache Logfiles

Wednesday, May 17th, 2006

There are a number of ways to rotate your log files, and I spent a bit of time looking into all the major ones. Unfortunately, none of them satisfy all my requirements. Here are my requirements:

  • put timestamp in archive file names
  • rotate weekly (I hate the clutter of daily logfiles)
  • work with awstats and other log processing programs

I find it fascinating that even though tens or hundreds of thousands of people use the Apache web server, that a critical mass of developers have not desired what I want. I think it’s because many sysadmins who install Apache find it’s fairly easy to write a small custom script to complete the functionality they’re missing out of the box.

Let me summarize the major tools available to you right now, and then I’ll list their deficiencies.

  • logrotate: This is a standard Unix tool to rotate any application logfiles, not just Apache logfiles. It’s nice that the default Debian install sets up a logrotate job for Apache.
    • Downside: The default configuration in /etc/logrotate.d/apache2 has the entries “weekly” and “rotate 52″, which means that after 52 weeks, it will start discarding your log files! That really disturbed me, I don’t want to start losing my log files a year from now just because I forgot to move my logfiles elsewhere.
    • Downside: The naming scheme sucks: access.log, access.log.1, access.log.2.gz, access.log.3.gz, etc. And all the files get renamed during each rotation, so this isn’t compatible with rsync’ing a local copy of the files.
  • rotatelogs: This little program comes with Apache. You use it by configuring Apache to pipe its logfiles through this program. In your configuration you can specify the template file name to use, using the well-known strftime abbreviations (e.g., “/var/log/apache2/access.%Y-%m.log” would make a log file named access.2006-05.log now).
    • Downside: Not readily compatible with log processing programs like awstats, which want to read a file named access.log. You have to do extra work to make programs like awstats work.
    • Downside: Since it’s configured as a pipe, Apache actually runs it as a separate process, and this increases the amount of resources used. If you have lots of logfiles open simultaneously (say, because you have virtual domains each with their own logfiles), then you better watch out that you don’t hit a soft or hard limit on number of processes or file handles.
    • Downside: Does not compress after rotating.
  • cronolog: This is a fork of rotatelogs above, with a couple nice enhancements: 1) you can create a symbolic link access.log file which always points to the latest timestamped logfile, and 2) you can create directory structures — “/var/log/apache2/%Y/access-%M.log” would create one subdirectory for each year.
    • Downside: You can’t specify the time period for rotations, it infers it by your template file name. In the above example, it would be monthly. I wanted weekly rotations.
    • Downside: Same resource issue as rotatelogs above since it is a piped logging program.
    • Downside: Does not compress after rotating.

So what did I do? In the end, I stuck with logrotate since it was already working, and then:

  • increased number of weeks before it would delete old files to 20 years (20*52=1040). The darn program doesn’t have a setting saying “keep indefinitely”
  • wrote a little script to rename the archived logfiles to have timestamps in the file names. I can just run it in a cron job. The script just does:


cd /var/log/apache2
for i in $( find . -name "access.log.*.gz" ); do mv -i $i access.log-`date -r $i +%Y-%m-%d__%H_%M_%S`.gz; done
for i in $( find . -name "error.log.*.gz" ); do mv -i $i error.log-`date -r $i +%Y-%m-%d__%H_%M_%S`.gz; done