Thursday, August 28, 2008

Slug and Syslog Server

One thing I miss about having the web server on the Slug, is having logfiles. Since it's running on a USB flash drive, I've turned off logging for everything so I don't kill the flash. I finally got around to setting it up to use a syslog server and pointed it at my HA box.

To do this, I edited /etc/syslog.conf on the Slug, setting DESTINATION to "remote" and REMOTE pointing to the HA server.

DESTINATION="remote" # log destinations (buffer file remote)
MARKINT=60 # interval between --mark-- entries [min]
REDUCE=no # reduced-size logging
BUFFERSIZE=64 # buffer: size of circular buffer [kByte]
LOGFILE= # file: where to log
REMOTE=aaa.bbb.ccc.ddd:514 # remote: where to log
FOREGROUND=no # run in foreground (don't use!)

In /etc/lighttpd.conf, I set up some conditionals for access logging:

$HTTP["url"] !~ "(\.css|\.js$)" {
$HTTP["remoteip"] != "aaa.bbb.ccc.0/24" {
accesslog.use-syslog = "enable"

Anything other than .css and .js files viewed from anywhere but my LAN will get logged. Cool.

Finally, I played around with few free syslog servers. None of them did what I wanted so I wrote my own in Perl. It's very simple so far and not very efficient with the logfile handling, but it works for now:

use warnings;

use IO::Socket;
use IO::Select;
use Sys::Hostname;

$port = 514;

$socket = IO::Socket::INET->new(
Proto => 'udp',
LocalPort => $port,
die "Could not create socket: $!\n" unless $socket;

print "syslog server\n";

while (defined($socket)) {
@msg=split(' ',$msg);

if ($msg[11] ne "") {
print "$msg[1] $msg[2] $msg[3] $msg[4] $msg[7] $msg[11]\n";
print SYSLOG "$msg\n";


Thursday, August 21, 2008

Slug Online

I ended up ditching Unslung for OpenSlug, mainly because OpenSlug has drivers for the EdgePort USB to serial adapter. (I'm planning on getting another Slug to use as a minimal HA controller for monitoring our other house.) I also dropped Apache for the lighttpd which has a smaller memory footprint. I dropped the idea of Squid as I ended up using my home router as a SOCKS proxy over SSH. I've got my Slug running off a 1GB flash drive and it uses a meager 4-5 watts! I had tested it running an 40GB USB hard drive and together, it used about 13 watts. The 466 MHz Celeron that has run the webserver for years uses about 35-40 watts, but that will get shutdown when I iron out a few remote access issues. The Celeron box currently is instrumental in accessing the home network and I hope to move that functionality to the firewall. It is no longer a webserver, as the Slug is doing that as of today.

Tuesday, August 19, 2008

Playing With The Slug

I received the NSLU2 yesterday and had a few cycles to play around with it. I flashed it with the latest Unslung firmware. That was pretty easy. I checked out a what packages are available to see what I could put on it. I installed OpenSSH, my public key. I also installed Apache as I'm pondering replacing my public webserver (running on a 466 MHz Celeron) with this. Finally, I did the overclocking mod to boost the Slug's CPU frequency from 133MHz to 266Mhz. Apparently, the unit I got was an older rev. I'm also looking into installing Squid as a proxy, not a cache, since I use my current webserver to proxy web traffic from work inside an SSH tunnel. I'm not sure if this will have the power to proxy better than the Celeron box.

Friday, August 15, 2008

Slug On The Way

I bought a Linksys NSLU2 (aka Slug) off eBay the other day. I took advantage of the Microsoft Live 25% Cashback promotion and saved a little extra. I'm not sure what I'm going to do with it, but I'm going to play around with Unslung and build a cheap, low power server out of it.

Monday, August 11, 2008

HA Burnout

I haven't been up to much with HA the last few weeks. I did a year's worth of projects in 1.5 months, and I've run out of ideas for projects I want to do. I did finish up xPL Gameport, but I haven't bundled it up for download yet. Not sure if I'll be doing much in the next couple months as we're contemplating some other much more costly home projects...