Log all the things!

I’ve tried to keep a diary a couple of times, but the habit never stuck. A few months ago I realized that what I really wanted was something like a cross between a time log and a journal. It had to be digital and searchable, because the main reason for wanting it was to be able to answer questions like:

  • How many days have I spent outside the USA in the last 5 years?
  • When did I send in the check for that bill the hospital thinks is still unpaid?
  • What was the confirmation number I got when I returned the broken laptop?
  • Who did we lend the yoga mat to?

In my head, I envisioned something like Twitter. A cloud-based web page with a minimal data entry form—just a text field. It would log each entry with time and date, and store them in some searchable format. The process had to be as easy as Twitter, or else I wouldn’t bother to log everything. Obviously actually posting the minutiae of my entire life on Twitter would have worked on a technical level, but didn’t meet my requirements for privacy and not boring the crap out of my friends.

I assumed someone else would have had the same idea, and looked around to see what I could find. Unfortunately, all the private Twitter clones still seem to be focused around broadcast, or at least narrowcast. The idea of Twitter as personal journal seems to be largely unexplored.

I briefly toyed with the idea of using syslog, formatted as per RFC 5424. The server software already existed, so all I’d need would be a trivial client program. I’d been implementing syslog-based logging at work and documenting the syslog API for Ruby, so I suppose everything was starting to look like a nail. I eventually decided the predefined list of syslog facilities was too limiting, and the priority system too useless, and pondered using a plain text file of ISO timestamp followed by line of text.

Eventually I gave in and started implementing something. I decided it would initially be web based so I could use it from my laptop and my phone. I then decided to use Ruby, for ease of implementation. I installed Rails 3, gagged in horror at the size of the dependency list full of stuff I would never use by choice, uninstalled it, and installed Sinatra. After thinking a bit about the joys of parsing and rewriting text files reliably, I installed DataMapper and SQLite instead. An afternoon of learning curve later, I had a working web application. A few teething troubles later, it was on my web host, protected by a username and password.

Then for fun, I added a REST API for clients, speaking JSON or plain text over HTTP. And a trivial command line client, for times when firing up a new browser window is just too much like hard work. If you’re interested, take a look at the source for it all. I’ll probably get around to adding the search function the first time I need to find something—how’s that for YAGNI? In the mean time, I’m by no means committed to this solution, if there’s something better that I’ve missed.