$(INSTALL_CONF) ./files/rsyslog.conf $(1)/etc
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/rsyslog.init $(1)/etc/init.d/rsyslog
- $(INSTALL_DIR) $(1)/etc/config
- $(INSTALL_CONF) ./files/rsyslog $(1)/etc/config
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_CONF) ./files/20_rsyslog $(1)/etc/uci-defaults
endef
define Package/rsyslog/config
--- /dev/null
+[ "$(sed -e '/^#/d' -e '/^\s*$/d' /etc/rsyslog.conf)" != "" ] && exit 0
+[ "$(uci -q get rsyslog.syslog)" == "syslog" ] && exit 0
+
+uci -q import rsyslog << EOI
+config syslog 'syslog'
+ option tcp_input_port '514'
+ option udp_input '1'
+ option tcp_input '0'
+ option udp_input_port '514'
+ option default_template 'RSYSLOG_TraditionalFileFormat'
+ list modules 'imuxsock'
+ list modules 'imklog'
+
+config selector
+ option source '*.info;mail.none;authpriv.none;cron.none'
+ option destination '/var/log/messages'
+
+config selector
+ option source 'authpriv.*'
+ option destination '/var/log/secure'
+
+config selector
+ option source 'mail.*'
+ option destination '/var/log/maillog'
+
+config selector
+ option source 'cron.*'
+ option destination '/var/log/cron'
+
+config selector
+ option source 'local7.*'
+ option destination '/var/log/boot.log'
+EOI
+++ /dev/null
-config syslog syslog
- option tcp_input '0'
- option tcp_input_port '514'
- option udp_input '1'
- option udp_input_port '514'
- option default_template 'RSYSLOG_TraditionalFileFormat'
- list modules 'imuxsock'
- list modules 'imklog'
-
-config selector
- option source '*.info;mail.none;authpriv.none;cron.none'
- option destination '/var/log/messages'
-
-config selector
- option source 'authpriv.*'
- option destination '/var/log/secure'
-
-config selector
- option source 'mail.*'
- option destination '/var/log/maillog'
-
-config selector
- option source 'cron.*'
- option destination '/var/log/cron'
-
-config selector
- option source 'local7.*'
- option destination '/var/log/boot.log'
-module(load="imuxsock")
-module(load="imklog")
-module(load="imudp")
-input(type="imudp" port="514")
-#module(load="imtcp")
-#input(type="imtcp" port="514")
-
-$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
-
-*.info;mail.none;authpriv.none;cron.none /var/log/messages
-
-authpriv.* /var/log/secure
-
-mail.* /var/log/maillog
-
-cron.* /var/log/cron
-
-local7.* /var/log/boot.log
+#
+# The preferred way to configure rsyslogd is now UCI.
+#
+# This file can be still used and will be included
+# on top of the final configuration inside /var/etc/rsyslog.conf
+#
+# Example of default configuration:
+#
+# module(load="imuxsock")
+# module(load="imklog")
+# module(load="imudp")
+# input(type="imudp" port="514")
+# $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+# *.info;mail.none;authpriv.none;cron.none /var/log/messages
+# authpriv.* /var/log/secure
+# mail.* /var/log/maillog
+# cron.* /var/log/cron
+# local7.* /var/log/boot.log