scanerrlog – Generate summaries/reports from Apache error logs

scanerrlog offers the possibility to generate a summary or report about Apache errors and sort them depending on how frequent they are.

To install it (for Ubuntu users):

sudo apt-get install scanerrlog

or use Synaptic and search for scanerrlog.

It’s written in Python, and it is very easy to use it. (type ‘man scanerrlog‘ in a terminal to see the manual page)

I tested it with Apache2 log files using the following command:

scanerrlog -f text -o /tmp/log.txt /var/log/apache2/*.log
  • -f : format (text, pdf, html, xml)
  • -o : output file
  • args : log files

Read the rest of this entry »

――

Cron, SSH, Rsync, and a ssh key with a passphrase (Ubuntu)

I recently scheduled some backup tasks on my VPS using backup-manager which is a neat program for this job. Everything is fine for that.
Then I wanted to set up a cron on my home computer to download the backup archives everyday. This wasn’t as easy as it sounded at first.
You might even get those errors:

Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at io.c(635) [receiver=3.0.3]

I need to connect to my VPS using a SSH key that is protected by a passphrase (password). This ssh key is added to my ssh agent (at login time).

The main problem is that cron is run using a restricted environment, meaning it doesn’t give environment variables like SSH_AUTH_SOCK.
This variable is needed by the ssh client in order to communicate with the ssh agent that will provide the information on the ssh key.

Here’s a workaround for it. It’s a quite secure way to fix this.
Read the rest of this entry »

――