Tuesday, April 28, 2009

LVM upgrade on non-LVM system

I did a strange thing. I *wasn't* using LVM, but I think I accidentally installed it and device-mapper went all bonkers and decided to take all my drives away so I couldn't mount them:

fsck.ext3: Device or resource busy while trying to open /dev/sda1
in boot log. It appears that device-mapper usurps the /dev/sda# ... my old fstab won't work. But I'm not going to wipe it out!

What *finally* fixed it for me:
fdisk -l | grep "Disk" | grep -v "identifier"
This gives me a list of devices I *can* mount and what their sizes are. I ignored the "doesn't contain a valid partition table"
nano /etc/fstab
and changed my /dev/sda# to /dev/dm-# according to my carefully hand-written notes that compared the sda* to the dm-*. NB: the number after dm- does not necessarily map with the number after /dev/sda. My sda# skips 3 and 4. My dm-# does not skip, and also starts at 0.

Wednesday, April 22, 2009

Dansguardian access.log summarizing, counting, unique

I have a dansguardian access.log file in smoothwall. I'd like to get a list of unique domains in use, and who'd be a sample IP address to check on.

This, my first effort, is good as far as it goes, which is to simply alphabetize the domains and give an IP address for *someone* who has accessed it:

awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort +1 -u


Of course, if I needed a date or time, I could add it in the print statement.


But now I think to myself, what about seeing how popular a domain (front part of url) is?

awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort +1 | awk '{a[$2] = $0; b[$2]++ } END {for(i in a){ print a[i] "\t" b[i]};}' | sort +1


This gives an IP address that has accessed the domain, and how many times that domain has been accessed. It DOES NOT mean that the IP address has accessed that domain that many times. If I wanted to do that ...


awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort | awk '{a[$0] = $0; b[$0]++ } END {for(i in a){ print a[i] "\t" b[i]};}' | sort


Further, you can use the above to see who "hogs" the web...
awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort | awk '{ a[$0] = $0; b[$0]++ } END {for(i in a){ print a[i] "\t" b[i]};}' | sort -r -n +2 -t " "

Inside the " " Linux users would use, in vi: ctrl-v, then Tab to put the real tab character. This puts the biggest numbers on top, so piping through more or head would be ideal.

I would argue that using these scripts is faster than most any other log analysis program, or use it in conjunction with your log analysis program.

Friday, April 17, 2009

I'm not ranting on Lauren

So, OK, I am, but in defense of Lauren ...


and bless him, Seth Weintraub makes good points, but in the end, it doesn't matter.

Look, I get it that the AMD processor isn't top of the line, nor is the RAM not super fast, nor is the LAN 100Mbps and the WIFI 802.11g. On the other hand, when Lauren starts getting online to the Internet from her ISP at greater than 8Mbps or starts moving files between her server and her laptop... Oh, wait. I get it that more could be had for the price, but did Lauren choose poorly because of any of the above? That, my friends, is in the eye of the beholder. Is Lauren likely to play Crisis? Probably not. Is Lauren going to be connected to any source that provides gigabit? Probably not. Yes, yes, it's nice to have the assurance that it's there when you could use it, just like Garage Band is. I use Vista Home Premium. It's not that horrible. I connect to my domain, use Outlook, even Terminal Services.

There are people who demand more. Those are the people who will choose their own operating system and supplier. There are then the other people who don't care. They buy what they can afford, and walk obliviously through the realm of techdom because they can, and to them, it works. Because it's just what they think they'll ever need.

Installing Java 6 release 13 on ubuntu

For Firefox (sudo su):

mkdir java6
cd java6
wget http://ftp.mgts.by/ubuntu/pool/multiverse/s/sun-java6/sun-java6-plugin_6-13-1_i386.deb
wget http://ftp.mgts.by/ubuntu/pool/multiverse/s/sun-java6/sun-java6-jre_6-13-1_all.deb
wget http://ftp.mgts.by/ubuntu/pool/multiverse/s/sun-java6/sun-java6-bin_6-13-1_i386.deb
dpkg -i *.deb

Blog Archive