Reasons to love virtual machines and avoiding 3rd party cloud hosting.

In the last few years we’ve been migrating all our servers over to KVM virtual machines running on a Ubuntu servers.  I’ve come to love VM’s.  There seems to be compelling reasons for using them.

  1. You can install a new VM very quickly without having to setup new hardware.
  2. You can control the resources for each VM really easily – scaling memory and cpu.  So it you can use resources more effectively.
  3. You can backup an VM server really easily.
  4. However, the best longterm reason is that you can move the VM’s really easily. For example, if you move to a new server hosting company, you just stop the VM instance, copy it to the new server host and restart it again.  Brilliant.  Even if you’re renting a dedicated server and are only going to use all it’s resources for one server, I highly recommend setting up the dedicated server as a host and running vm on top.  This single VM can use all the cpu and memory.  The overhead is very low and when you come to more to another dedicate host it will save you hours of configuration – just copy the VM.

We have avoided using cloud hosting (such as Amazon, Rackspace or Linode) for several reasons:

  1. Your data isn’t in your control.  I want my data on my hard drives.
  2. Unlike the simplicity of raw or qcow2 disk images, you can’t move to an cloud hosted server very easily.  Yes, I know Openstack is supposed to solve this problem – but in the meantime have you tried migrating from Linode? Basically, you need to reinstall.
  3. If you have more than one server or need lots of space / cpu power then it is often cheaper hosting it yourself.

Basically, I think that VM’s rock. What do you think?

How to configure Ubuntu to log to a remote syslog server

I just installed a new Syncology 814 server in our rack to give us some more storage for backups.   It is very simple to use and well made.  While browsing through the software that comes with the NAS,  I discovered it has a centralised syslog server. There are instructions for installing the Syncology syslog server are here:

I’ve always wanted to centralise the syslogs of my servers to help with debugging. The key reasons are ensure that we have logs in the event a server was hacked and if a virtual machine crashes I can review the logs before restarting it.

Anyhow, I found it hard to find instructions for configuring Ubuntu 12.04 to send their syslog messages to the syslog server. As always – it is really simple when you know how.

Ubuntu uses a service called rsyslogd.  Its configuration file is located at:

/etc/rsyslog.d/50-default.conf

This file tells the deamon where to log each type of message. For example – the follow entry means that all cron message are sent to /var/log/cron.log:

cron.* /var/log/cron.log

If you want to the cron messages to also be sent our new remote syslog server, then you can add this entry.

cron.* @syslogserverhostname:514

To keep it really simple – I wanted all my messages send to the syslog server.  Why not – you can always filter them later.  I simply added:

*.* @syslogserverhostname:514

You need to restart the rsyslogd for the settings to take affect.

service rsyslog restart

Voila.  Happy Syslogging.