<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=Set_up_Domoticz_to_syslog</id>
	<title>Set up Domoticz to syslog - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=Set_up_Domoticz_to_syslog"/>
	<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=Set_up_Domoticz_to_syslog&amp;action=history"/>
	<updated>2026-09-19T22:43:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.domoticz.com/index.php?title=Set_up_Domoticz_to_syslog&amp;diff=12321&amp;oldid=prev</id>
		<title>Fredclo at 11:36, 12 May 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=Set_up_Domoticz_to_syslog&amp;diff=12321&amp;oldid=prev"/>
		<updated>2019-05-12T11:36:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
=Purpose=&lt;br /&gt;
&lt;br /&gt;
In this page, we will describe how to make Domoticz log to syslog. In this case it is set up to use &amp;#039;&amp;#039;rsyslog&amp;#039;&amp;#039;. Other syslog implementation should be very similar.&lt;br /&gt;
&lt;br /&gt;
The purpose of this is to be able to send the Domoticz log to other systems for remote logging, be able to separate the Domoticz log into separate syslog facilities/logfiles and/or consolidate the logs from several Domoticz instances on a shared loghost.&lt;br /&gt;
&lt;br /&gt;
= Preparations = &lt;br /&gt;
&lt;br /&gt;
For this setup, you will need to use a version of Domoticz that supports selecting the syslog facility to be used. The help text indicating this is supported is:&lt;br /&gt;
&lt;br /&gt;
 $ ./domoticz -h &lt;br /&gt;
 2016-03-09 20:18:17.747  Domoticz &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;V3.4933&amp;lt;/span&amp;gt; (c)2012-2016 GizMoCuz&lt;br /&gt;
 2016-03-09 20:18:17.894  Build Hash: e404b11, Date: 2016-03-09 17:30:00&lt;br /&gt;
 .&lt;br /&gt;
 . (lines deleted)&lt;br /&gt;
 .&lt;br /&gt;
 -syslog &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;[user|daemon|local0 .. local7]&amp;lt;/span&amp;gt; (use syslog as log output, defaults to facility &amp;#039;user&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
Versions before this will log to syslog faciliity &amp;#039;&amp;#039;user&amp;#039;&amp;#039; (a.k.a. LOG_USER), which is still the default if no argument is provided&lt;br /&gt;
&lt;br /&gt;
Syslog facilities are message properties that can be used in your &amp;lt;tt&amp;gt;/etc/rsyslog.conf&amp;lt;/tt&amp;gt; file to determine how to further route the messages into files and/or relay messages to remote syslog servers. &lt;br /&gt;
&lt;br /&gt;
= Setup procedure =&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Change the DAEMON_ARGS&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You will need to edit &amp;lt;tt&amp;gt;/etc/init.d/domoticz.sh&amp;lt;/tt&amp;gt; and make the &amp;#039;&amp;#039;DAEMON_ARGS&amp;#039;&amp;#039; include at least:&lt;br /&gt;
&lt;br /&gt;
  DAEMON_ARGS=&amp;quot;-loglevel normal -syslog local1 -daemon -www ..........&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Where the Domoticz log level and syslog facility is your choice.   &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Set up a dedicated syslog logfile for Domoticz&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This an optional step, You may want to supplement the above &amp;#039;&amp;#039;local1&amp;#039;&amp;#039; log facility with a separate syslog file. For rsyslog, that can be set up as follows in &amp;lt;tt&amp;gt;/etc/rsyslog.conf&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 user.info                       -/var/log/user.log&lt;br /&gt;
 local0.info                     -/var/log/local0.log&lt;br /&gt;
 local1.info                     -/var/log/local1.log&lt;br /&gt;
 local2.info                     -/var/log/local2.log&lt;br /&gt;
&lt;br /&gt;
If you want to send the same to a remote system, use an ip address or hostname, or more commonly a &amp;#039;&amp;#039;loghost&amp;#039;&amp;#039; alias, as follows:&lt;br /&gt;
&lt;br /&gt;
 user.info                       @@loghost&lt;br /&gt;
 local0.info                     @loghost&lt;br /&gt;
 local1.info                     @loghost&lt;br /&gt;
 local2.info                     @192.168.5.100&lt;br /&gt;
&lt;br /&gt;
The first entry will log using a TCP connection (more modern syslog implementations), the other will use UDP datagrams (legacy) for the message protocol transport&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Restart services&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can now restart Domoticz and rsyslog&lt;br /&gt;
 sudo service rsyslog restart&lt;br /&gt;
 sudo service domoticz.sh restart&lt;br /&gt;
&lt;br /&gt;
Then make sure that the logfiles update:&lt;br /&gt;
 tail -f /var/log/local1.log&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Set up log rotation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If your /var/log filesystem is small, you will want to set up log rotation as well. In Raspian and many other Linux distros, the &amp;#039;&amp;#039;logrotate&amp;#039;&amp;#039; utility runs from a daily cron job (ref &amp;lt;tt&amp;gt;/etc/cron.daily/logrotate&amp;lt;/tt&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
A suggested setup can be set up by creating a &amp;lt;tt&amp;gt;/etc/logrotate.d/local&amp;lt;/tt&amp;gt; configuration file containing the following:&lt;br /&gt;
 /var/log/local*.log&lt;br /&gt;
 {&lt;br /&gt;
        rotate 4&lt;br /&gt;
        weekly&lt;br /&gt;
        maxsize 64M&lt;br /&gt;
        missingok&lt;br /&gt;
        notifempty&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                invoke-rc.d rsyslog rotate &amp;gt; /dev/null&lt;br /&gt;
        endscript&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Refer to &amp;lt;tt&amp;gt;man logrotate&amp;lt;/tt&amp;gt; for an explanation of the semantics of this.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Take care if you use a SD card for the &amp;lt;tt&amp;gt;/var/log&amp;lt;/tt&amp;gt; files. Logging a lot will likely make the SD card fail over time.&lt;br /&gt;
&lt;br /&gt;
Consider to use tmpfs or look into [[Setting up overlayFS on Raspberry Pi]] instead&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Domoticz]]&lt;br /&gt;
[[Category:Manual]]&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Raspberry Pi]]&lt;/div&gt;</summary>
		<author><name>Fredclo</name></author>
	</entry>
</feed>