Wednesday, 19 September 2012

Maximum Logrotate Compression with bzip2

A Tip for squeezing a little more free space from a VPS

KL Insight's Web Design VPS with Linode has been rock a solid solution over the last 4 years. It currently hosts multiple client sites and mail agent and all these sites and emails quickly eat up precious hard drive space; and with only 20GB the wall can be hit early.

The measly 20GB does comes with a kick ass IO rate that beats even some dedicated servers

Stop blabering and get to it

Linux logs everything, these logs grow overtime, systems run 'logrotate' to archive and delete old logs - the settings are very liberal and tweaking them could save gigabytes of space, 1.1GB in my instance. Modify your /etc/logrotate.conf as needed but the important bit is compressing by default and using bzip2 instead of gzip to do so.

# see "man logrotate" for details
# rotate log files weekly

# keep x weeks worth of backlogs - default 4
rotate 2

# Archive log files by adding a YYYYMMDD instead of simply adding a number.

# create new (empty) log files after rotating old ones

# uncomment this if you want your log files compressed

# use bzip2 which is higher compression the gzip used by default
compresscmd /bin/bzip2
compressoptions -9
compressext .bz2
uncompresscmd /bin/bunzip2

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    create 0664 root utmp
    rotate 1

/var/log/btmp {
    create 0660 root utmp
    rotate 1

# system-specific logs may be configured here

There are also specific application/services blog settings in the /etc/logrotate.d directory. Apache by default keeps it's logs for a lengthy 52 weeks! This can be changed by modifying the /etc/logrotate.d/apache2 file as shown below:

/var/log/apache2/*.log {
        # rotate 52
        create 640 root adm
                /etc/init.d/apache2 reload > /dev/null

Be legendary and do social like this post as that helps me immensely.

Tuesday, 11 September 2012

Google Analytics Reverse Lookup

Locating the administrator of a Google Analytics account

For whatever reasons in certain situations a client might have not been granted access to their Google Analytics information by their former developer. This normally is not an issue as developer are mostly a friendly bunch and when asked will grant proper access, but what if the former developer's identity is unknown or lost? - yes rather unlikely scenario but this has happened to us and it can happen to you.

Google Analytics tracking ID reverse lookup by ewhois

On the surface ewhois is your typical look up service with the one and important exception is that it allows tracking down the administrator of analytics tracking code. This can be accomplished due to the fact that site tracking codes contain a common id representing the parent account.

KL Insight Web Design Google Analytics tracking codes are UA-15511708-X where X is the unique id of a tracked site. Based on this fact ewhois is able to return other related sites from it's database

Now with a bit of luck (that the designer is using the same account to track their own site and that ewhois's database contains the information) and some detective work it easy to find the developers business site and their contact information.

Please social this post if it has helped you.