====== Login/Logoff logging plugin ====== ---- plugin ---- description: Logs all login and logout actions with time, IP and username author : Andreas Gohr email : andi@splitbrain.org type : action lastupdate : 2008-06-11 compatible : 2008-05-05 and newer depends : conflicts : similar : tags : login, logout, authentication, logging ---- This Plugin will log all logins and logouts to ''data/cache/loglog.log''. ===== Download ===== * {{http://dev.splitbrain.org/download/snapshots/loglog-plugin-latest.tgz}} There is a [[devel:darcs]] repository available at [[http://dev.splitbrain.org/darcsweb/darcsweb.cgi?r=dwplugins/loglog;a=summary| http://dev.splitbrain.org/darcs/dwplugins/loglog/]]. ==== Changes ==== {{rss>http://dev.splitbrain.org/darcsweb/darcsweb.cgi?r=dwplugins/loglog;a=rss}} ===== Mod: Log to a wiki page ===== This small change: * allows you to view the loglog (login/logoff logfile) information directly from your DokuWiki * shows you the most recent logins/logoff on the top of the list and not at the end as in the original version The idea is just to create and modify a DokuWiki loglog.txt article in the wiki namespace (instead of writing it to the data/cache/loglog.log file). You get a list like: * 2008/01/08 18:22 0.0.0.0 **user4**: **logged in temporarily** * 2008/01/08 16:56 0.0.0.0 **user3**: **logged off** * 2008/01/08 16:52 0.0.0.0 **user3**: **logged in temporarily** * 2008/01/08 15:22 0.0.0.0 **user2**: **logged off** * 2008/01/08 15:17 0.0.0.0 **user2**: **logged in temporarily** * 2008/01/08 14:53 0.0.0.0 **user1**: **logged off** * 2008/01/08 14:51 0.0.0.0 **user1**: **logged in temporarily** If you want to remove old logging info, you can simply remove lines from this wiki:loglog.txt article manually. Here is the alternative _log function (to be changed in the plugin's ''action.php''): function _log($msg){ global $conf; $t = time(); $log = " * "."\t".strftime($conf['dformat'],$t)."\t".$_SERVER['REMOTE_ADDR']."\t\t**".$_SERVER['REMOTE_USER']."**:\t**".$msg."** \n"; /*io_saveFile($conf['cachedir'].'/loglog.log',"$log\n",true);*/ $logFilename = $conf['datadir'].'/loglog.txt'; // read logfile $fc=file($logFilename); // Add the new log message to the logfile ... $f = fopen($logFilename, 'w') or die("can't open file"); fwrite($f, $log); fclose($f); // ... and the lines that were already in the log file $f = fopen($logFilename, 'a') or die("can't open file"); foreach($fc as $line) { fwrite($f, $line); } fclose($f); } --- //[[Juergen.Mue76@web.de|Juergen Mueller]] 2008-01-08 18:26//