<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [

<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
%docentities;

]>
<!-- Module User's Guide -->

<chapter>
	
	<title>&adminguide;</title>
	
	<section>
	<title>Overview</title>
	<para>
		It provides logging to systemd journal from the moment
		of loading this module.
	</para>
	</section>

	<section>
	<title>Dependencies</title>
	<section>
		<title>&kamailio; Modules</title>
		<para>
		The following modules must be loaded before this module:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>none</emphasis>.
			</para>
			</listitem>
			</itemizedlist>
		</para>
	</section>
	<section>
		<title>External Libraries or Applications</title>
		<para>
		The following libraries or applications must be installed before running
		&kamailio; with this module loaded:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>libsystemd</emphasis>
			</para>
			</listitem>
			</itemizedlist>
		</para>
	</section>
	</section>

	<section>
	<title>Core Logging</title>
		<para>
		This module can replace the syslog logging with sending the log messages
		to systemd journal. The logging to systemd is
		started when this module is loaded, before that the default
		syslog system is used.
		</para>
		<para>
		It requires that core parameters log_engine_type to be set to 'systemd'.
		It is not enabled if log_stderror=yes.
		</para>
		<example>
		<title><function>Core Logging Replacement with Systemd</function></title>
		<programlisting format="linespecific">
...
log_engine_type="systemd"
...
loadmodule "log_systemd.so"
...
</programlisting>
	    </example>
	</section>

	<section>
	<title>Functions</title>
	<section id="log_systemd.f.sd_journal_print">
	    <title>
		<function moreinfo="none">sd_journal_print(level, text)</function>
	    </title>
		<para>
		Print the text in the systemd journal at the provided level parameter.
		</para>
		<para>
		Both parameters can contain variables.
		</para>
		<para>
		For more, see the manual page for function sd_journal_print() in C library libsystemd.
		</para>
		<para>
		This function can be used from ANY_ROUTE.
		</para>
		<example>
		<title><function>sd_journal_print</function> usage</title>
		<programlisting format="linespecific">
...
   sd_journal_print("LOG_INFO", "R-URI is $ru\n");
...
</programlisting>
	    </example>
	</section>
	</section>
</chapter>

