Translations of this page?:

Login/Logoff logging plugin

loglog plugin by Andreas Gohr
Logs all login and logout actions with time, IP and username

Last updated on 2008-06-11. Provides Action.
Compatible with DokuWiki 2008-05-05 and newer.

Tagged with authentication, logging, login, logout.

This Plugin will log all logins and logouts to data/cache/loglog.log.

Download

There is a darcs repository available at http://dev.splitbrain.org/darcs/dwplugins/loglog/.

Small change

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 action.php):

 function _log($msg){
        global $conf;
 
        $t   = time();
        $log = "  * "."\t".date($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 = 'data/pages/wiki/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 Mueller 2008-01-08 18:26


Proposition: If you use strftime() instead of date() you'll get a correctly formatted output in your logfile.

        $log = "  * "."\t".strftime($conf['dformat'],$t)."\t".$_SERVER['REMOTE_ADDR']."\t\t**".$_SERVER['REMOTE_USER']."**:\t**".$msg."**  \n";

Anonymous Contributor 2008-04-14 15:12


for better compatibility with other installation use:

$logFilename = $conf['datadir'].'/loglog.txt';
 
plugin/loglog.txt · Last modified: 2008/08/18 17:54 by 194.175.52.146
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate