lemonldap-ng/doc/pages/documentation/current/logs.html
Xavier Guimard 5d13d022a4 Update doc
2018-07-14 22:23:25 +02:00

257 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>documentation:2.0:logs</title>
<meta name="generator" content="DokuWiki"/>
<meta name="robots" content="index,follow"/>
<meta name="keywords" content="documentation,2.0,logs"/>
<link rel="search" type="application/opensearchdescription+xml" href="lib/exe/opensearch.html" title="LemonLDAP::NG"/>
<link rel="start" href="logs.html"/>
<link rel="contents" href="logs.html" title="Sitemap"/>
<link rel="stylesheet" type="text/css" href="lib/exe/css.php.t.bootstrap3.css"/>
<!-- //if:usedebianlibs
<link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap.min.css" />
//elsif:useexternallibs
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></script>
//elsif:cssminified
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.min.css" />
//else -->
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.css" />
<!-- //endif -->
<script type="text/javascript">/*<![CDATA[*/var NS='documentation:2.0';var JSINFO = {"id":"documentation:2.0:logs","namespace":"documentation:2.0"};
/*!]]>*/</script>
<script type="text/javascript" charset="utf-8" src="lib/exe/js.php.t.bootstrap3.js"></script>
<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery/jquery.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.js"></script>
<!-- //endif -->
<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery-ui/jquery-ui.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery-ui/jquery-ui.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery-ui/jquery-ui.js"></script>
<!-- //endif -->
</head>
<body>
<div class="dokuwiki export container">
<!-- TOC START -->
<div id="dw__toc">
<h3 class="toggle">Table of Contents</h3>
<div>
<ul class="toc">
<li class="level1"><div class="li"><a href="#default_loggers">Default loggers</a></div></li>
<li class="level1"><div class="li"><a href="#log_levels">Log levels</a></div>
<ul class="toc">
<li class="level2"><div class="li"><a href="#technical_log_levels">Technical log levels</a></div></li>
<li class="level2"><div class="li"><a href="#log_levels_for_user_actions">Log levels for user actions</a></div></li>
</ul>
</li>
<li class="level1"><div class="li"><a href="#logger_configuration">Logger configuration</a></div>
<ul class="toc">
<li class="level2"><div class="li"><a href="#std_logger">Std logger</a></div></li>
<li class="level2"><div class="li"><a href="#apache2_logger">Apache2 logger</a></div></li>
<li class="level2"><div class="li"><a href="#syslog">Syslog</a></div></li>
<li class="level2"><div class="li"><a href="#log4perl">Log4perl</a></div></li>
<li class="level2"><div class="li"><a href="#sentry">Sentry</a></div></li>
<li class="level2"><div class="li"><a href="#dispatch">Dispatch</a></div></li>
</ul></li>
</ul>
</div>
</div>
<!-- TOC END -->
<h1 class="sectionedit1" id="logs">Logs</h1>
<div class="level1">
<p>
LemonLDAP::NG provides 5 levels of error and has two kind of logs:
</p>
<ul>
<li class="level1"><div class="li"> technical logs</div>
</li>
<li class="level1"><div class="li"> user actions logs</div>
</li>
</ul>
<p>
Each category can be handle by a different logging framework. You can choose between:
</p>
<ul>
<li class="level1"><div class="li"> <strong>Lemonldap::NG::Common::Logger::Std</strong>: standard output (mapped in web server logs, see below)</div>
</li>
<li class="level1"><div class="li"> <strong>Lemonldap::NG::Common::Logger::Syslog</strong>: syslog logging</div>
</li>
<li class="level1"><div class="li"> <strong>Lemonldap::NG::Common::Logger::Apache2</strong>: use Apache2 logging, levels are stored in Apache2 logs and the log level is defined by <code>LogLevel</code> Apache parameter</div>
</li>
<li class="level1"><div class="li"> <strong>Lemonldap::NG::Common::Logger::Log4perl</strong>: use <code>Log4perl</code> framework to log <em>(inspired by Java Log4J)</em></div>
</li>
<li class="level1"><div class="li"> <strong>Lemonldap::NG::Common::Logger::Sentry <em>(experimental)</em></strong>: use <a href="https://sentry.io" class="urlextern" title="https://sentry.io" rel="nofollow">Sentry</a> to store logs</div>
</li>
<li class="level1"><div class="li"> <strong>Lemonldap::NG::Common::Logger::Dispatch</strong>: dispatch logs in other backends depending on log level</div>
</li>
</ul>
<div class="noteimportant">Except for Apache2 and Log4Perl, log level is defined by <code>logLevel</code> parameter set in <code>lemonldap-ng.ini</code> file. Logger configurations are defined in lemonldap-ng.ini.
</div>
<p>
Example:
</p>
<pre class="code file ini"><span class="re0"><span class="br0">&#91;</span>all<span class="br0">&#93;</span></span>
<span class="re1">logger</span> <span class="sy0">=</span><span class="re2"> Lemonldap::NG::Common::Logger::Log4perl</span>
<span class="re1">userLogger</span> <span class="sy0">=</span><span class="re2"> Lemonldap::NG::Common::Logger::Syslog</span>
<span class="re1">logLevel</span> <span class="sy0">=</span><span class="re2"> notice</span></pre>
<p>
You can also modify these values in each lemonldap-ng.ini section to have different values for portal, manager and handlers.
</p>
<p>
Therefore, LLNG provides a username that can be used by webservers in their access log. To configure the user identifier to write into access logs, go into Manager, <code>General Parameters</code> &gt; <code>Logging</code> &gt; <code>REMOTE_USER</code>.
</p>
</div>
<!-- EDIT1 SECTION "Logs" [1-1571] -->
<h2 class="sectionedit2" id="default_loggers">Default loggers</h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> Apache handlers use by default Apache2 logger. This logger can&#039;t be used for other LLNG components</div>
</li>
<li class="level1"><div class="li"> Except when launched by LLNG FastCGI server <em>(used by Nginx)</em>, Portal and Manager use Std logger by default</div>
</li>
<li class="level1"><div class="li"> All components launched by LLNG FastCGI server use Syslog by default</div>
</li>
</ul>
</div>
<!-- EDIT2 SECTION "Default loggers" [1572-1891] -->
<h2 class="sectionedit3" id="log_levels">Log levels</h2>
<div class="level2">
</div>
<!-- EDIT3 SECTION "Log levels" [1892-1915] -->
<h3 class="sectionedit4" id="technical_log_levels">Technical log levels</h3>
<div class="level3">
<ul>
<li class="level1"><div class="li"> <strong>error</strong> is used for problems that must be reported to administrator and needs an action. In this case, some feature may not work</div>
</li>
<li class="level1"><div class="li"> <strong>warn</strong> is used for problems that doesn&#039;t block LLNG features but should be solved</div>
</li>
<li class="level1"><div class="li"> <strong>notice</strong> is used for actions that must be kept in logs</div>
</li>
<li class="level1"><div class="li"> <strong>info</strong> display some technical information</div>
</li>
<li class="level1"><div class="li"> <strong>debug</strong> produce a lot a debugging logs</div>
</li>
</ul>
</div>
<!-- EDIT4 SECTION "Technical log levels" [1916-2325] -->
<h3 class="sectionedit5" id="log_levels_for_user_actions">Log levels for user actions</h3>
<div class="level3">
<ul>
<li class="level1"><div class="li"> <strong>error</strong> is used to log bad user actions that looks malicious</div>
</li>
<li class="level1"><div class="li"> <strong>warn</strong> is used to log some errors like “bad password”</div>
</li>
<li class="level1"><div class="li"> <strong>notice</strong> is used for actions that must be kept in logs for accounting (connections, logout)</div>
</li>
<li class="level1"><div class="li"> <strong>info</strong> display some useful information like handler authorizations (at least 1 for each HTTP hit)</div>
</li>
<li class="level1"><div class="li"> <strong>debug</strong> isn&#039;t used</div>
</li>
</ul>
</div>
<!-- EDIT5 SECTION "Log levels for user actions" [2326-2719] -->
<h2 class="sectionedit6" id="logger_configuration">Logger configuration</h2>
<div class="level2">
</div>
<!-- EDIT6 SECTION "Logger configuration" [2720-2753] -->
<h3 class="sectionedit7" id="std_logger">Std logger</h3>
<div class="level3">
<p>
Nothing to configure except logLevel.
</p>
</div>
<!-- EDIT7 SECTION "Std logger" [2754-2814] -->
<h3 class="sectionedit8" id="apache2_logger">Apache2 logger</h3>
<div class="level3">
<p>
The log level can be set with Apache <code>LogLevel</code> parameter. It can be configured globally, or inside a virtual host.
</p>
<p>
See <a href="http://httpd.apache.org/docs/current/mod/core.html#loglevel" class="urlextern" title="http://httpd.apache.org/docs/current/mod/core.html#loglevel" rel="nofollow">http://httpd.apache.org/docs/current/mod/core.html#loglevel</a> for more information.
</p>
</div>
<!-- EDIT8 SECTION "Apache2 logger" [2815-3050] -->
<h3 class="sectionedit9" id="syslog">Syslog</h3>
<div class="level3">
<p>
You can choose facility in lemonldap-ng.ini file. Default values:
</p>
<pre class="code file ini"><span class="re1">syslogFacility</span> <span class="sy0">=</span><span class="re2"> daemon</span>
<span class="re1">userSyslogFacility</span> <span class="sy0">=</span><span class="re2"> auth</span></pre>
</div>
<!-- EDIT9 SECTION "Syslog" [3051-3209] -->
<h3 class="sectionedit10" id="log4perl">Log4perl</h3>
<div class="level3">
<p>
You can indicate the Log4perl configuration file and the classes to use. Default values:
</p>
<pre class="code file ini"><span class="re1">log4perlConfFile</span> <span class="sy0">=</span><span class="re2"> /etc/log4perl.conf</span>
<span class="re1">log4perlLogger</span> <span class="sy0">=</span><span class="re2"> LLNG</span>
<span class="re1">log4perlUserLogger</span> <span class="sy0">=</span><span class="re2"> LLNG.user</span></pre>
</div>
<!-- EDIT10 SECTION "Log4perl" [3210-3436] -->
<h3 class="sectionedit11" id="sentry">Sentry</h3>
<div class="level3">
<p>
You just have to give your DSN:
</p>
<pre class="code file ini"><span class="re1">sentryDsn</span> <span class="sy0">=</span><span class="re2"> https://...</span></pre>
<div class="noteimportant">This experimental logger requires <a href="https://metacpan.org/pod/Sentry::Raven" class="urlextern" title="https://metacpan.org/pod/Sentry::Raven" rel="nofollow">Sentry::Raven</a> Perl module.
</div>
</div>
<!-- EDIT11 SECTION "Sentry" [3437-3658] -->
<h3 class="sectionedit12" id="dispatch">Dispatch</h3>
<div class="level3">
<p>
Use it to use more than one logger. Example:
</p>
<pre class="code file ini"><span class="re1">logger</span> <span class="sy0">=</span><span class="re2"> Lemonldap::NG::Common::Logger::Dispatch</span>
<span class="re1">userLogger</span> <span class="sy0">=</span><span class="re2"> Lemonldap::NG::Common::Logger::Dispatch</span>
<span class="re1">logDispatchError</span> <span class="sy0">=</span><span class="re2"> Lemonldap::NG::Common::Logger::Sentry</span>
<span class="re1">logDispatchNotice</span> <span class="sy0">=</span><span class="re2"> Lemonldap::NG::Common::Logger::Syslog</span>
<span class="re1">userLogDispatchError</span> <span class="sy0">=</span><span class="re2"> Lemonldap::NG::Common::Logger::Sentry</span>
<span class="co0">; Other parameters</span>
<span class="re1">syslogFacility</span> <span class="sy0">=</span><span class="re2"> daemon</span>
<span class="re1">sentryDsn</span> <span class="sy0">=</span><span class="re2"> https://...</span></pre>
<div class="noteimportant">At least <code>logDispatchError</code> <em>(or <code>userLogDispatchError</code> for user logs)</em> must be defined. All sub level will be dispatched on it, until another lever is declared. In the above example, Sentry collects <code>error</code> and <code>warn</code> levels and all user actions, while syslog stores technical <code>notice</code>, <code>info</code> and <code>debug</code> logs.
</div>
</div>
<!-- EDIT12 SECTION "Dispatch" [3659-] --></div>
</body>
</html>