diff --git a/modules/cron/default-disable b/modules/cron/default-disable
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/modules/cron/hooks/hook_cron.php b/modules/cron/hooks/hook_cron.php
new file mode 100644
index 0000000000000000000000000000000000000000..6113523d30130749412c687e33b418a540f482d4
--- /dev/null
+++ b/modules/cron/hooks/hook_cron.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Hook to run a cron job.
+ *
+ * @param array &$croninfo  Output
+ */
+function cron_hook_cron(&$croninfo) {
+	assert('is_array($croninfo)');
+	assert('array_key_exists("summary", $croninfo)');
+	assert('array_key_exists("tag", $croninfo)');
+
+	$config = SimpleSAML_Configuration::getInstance();
+	$cronconfig = $config->copyFromBase('cron', 'module_cron.php');
+	
+	if ($cronconfig->getValue('debug_message', TRUE)) {
+
+		$croninfo['summary'][] = 'Cron did run tag [' . $croninfo['tag'] . '] at ' . date(DATE_RFC822);
+	}
+
+}
+?>
\ No newline at end of file
diff --git a/modules/cron/www/cron.php b/modules/cron/www/cron.php
new file mode 100644
index 0000000000000000000000000000000000000000..b1c56e267015cfe70e23e760ccd76a1d24592a3c
--- /dev/null
+++ b/modules/cron/www/cron.php
@@ -0,0 +1,54 @@
+<?php
+
+$config = SimpleSAML_Configuration::getInstance();
+$cronconfig = $config->copyFromBase('cron', 'module_cron.php');
+
+if (!is_null($cronconfig->getValue('key'))) {
+	if ($_REQUEST['key'] !== $cronconfig->getValue('key')) {
+		SimpleSAML_Logger::error('Cron - Wrong key provided. Cron will not run.');
+		exit;
+	}
+}
+#print_r($_REQUEST['tag']) ; exit;
+
+if (!is_null($cronconfig->getValue('allowed_tags'))) {
+	if (!in_array($_REQUEST['tag'], $cronconfig->getValue('allowed_tags'))) {
+		SimpleSAML_Logger::error('Cron - Illegal tag [' . $_REQUEST['tag'] . '].');
+		exit;
+	}
+}
+
+$summary = array(); 
+$croninfo = array(
+	'summary' => &$summary,
+	'tag' => $_REQUEST['tag'],
+);
+SimpleSAML_Module::callHooks('cron', $croninfo);
+
+foreach ($summary AS $s) {
+	SimpleSAML_Logger::debug('Cron - Summary: ' . $s);
+}
+
+if ($cronconfig->getValue('sendemail', TRUE) && count($summary) > 0) {
+
+	$statustext = '<ul><li>' . join('</li><li>', $summary) . '</li></ul>';
+
+	$message = '<h1>Cron report</h1><p>Cron ran at ' . date(DATE_RFC822) . '</p>' . 
+		'<p>Tag: ' . $_REQUEST['tag'] . "</p>\n\n" . $statustext;
+
+	$toaddress = $config->getValue('technicalcontact_email', 'na@example.org');
+	if($toaddress == 'na@example.org') {		
+		SimpleSAML_Logger::error('Cron - Could not send email. [technicalcontact_email] not set in config.');
+	} else {
+		$email = new SimpleSAML_XHTML_EMail($toaddress, 'simpleSAMLphp cron report', 'no-reply@simplesamlphp.com');
+		$email->setBody($message);
+		$email->send();
+	}
+	
+}
+
+#$t = new SimpleSAML_XHTML_Template($config, 'modinfo:modlist.php');
+#$t->data['modules'] = $modinfo;
+#$t->show();
+
+?>
\ No newline at end of file
diff --git a/modules/statistics/bin/loganalyzer.php b/modules/statistics/bin/loganalyzer.php
index ec0a813c8f923a61634e4976a79aa4d64f9d3883..652e3f3c93ca6f77451d514a607d27d97663d979 100755
--- a/modules/statistics/bin/loganalyzer.php
+++ b/modules/statistics/bin/loganalyzer.php
@@ -46,7 +46,9 @@ function parse23($str) {
 $results = array();
 # Sat, 16 Feb 08 00:55:11  (23 chars)
 foreach ($logfile AS $logline) {
-	$datenumbers = 15;
+	$datenumbers = 19;
+	
+	if (!preg_match('/^[0-9]{4}/', $logline)) continue;
 
 	$datestr = substr($logline,0,$datenumbers);
 	#$datestr = substr($logline,0,23);
@@ -55,14 +57,23 @@ foreach ($logfile AS $logline) {
 	$restcols = split(' ', $restofline);
 	$action = $restcols[5];
 	
-#	print_r($restcols); exit;
+// 	print_r($timestamp);
+// 	print_r($restcols); if ($i++ > 5) exit;
 	
 	foreach ($statrules AS $rulename => $rule) {
 		$timeslot = floor($timestamp/$rule['slot']);
 		$fileslot = floor($timestamp/$rule['fileslot']);
-		if ($action !== $rule['action']) continue; 
+		
+		if (isset($rule['action'])) {
+			if ($action !== $rule['action']) continue; 
+		}
 		
 		$difcol = $restcols[$rule['col']];
+		$difcolsp = split('@', $difcol);
+		$difcol = $difcolsp[1];
+		
+// 		print(' foo: ' . $difcol . ' :  ' . $rule['col']); exit;
+		
 		$results[$rulename][$fileslot][$timeslot]['_']++;
 		$results[$rulename][$fileslot][$timeslot][$difcol]++;
 	}
@@ -72,7 +83,7 @@ foreach ($logfile AS $logline) {
 
 
 echo "Results:\n";
-print_r($results);
+#print_r($results);