rsyslog: initial addon

This commit is contained in:
jc 2016-09-04 19:49:34 +02:00 committed by awiouy
parent d68e38da4e
commit dfa26885cf
12 changed files with 271 additions and 0 deletions

View File

@ -0,0 +1,2 @@
8.0.100
- Initial addon

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1,59 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2016 Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="rsyslog"
PKG_VERSION="8.21.0"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/rsyslog"
PKG_URL="http://www.rsyslog.com/files/download/rsyslog/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain util-linux libestr libfastjson liblognorm librelp zlib libgcrypt liblogging"
PKG_SECTION="service"
PKG_PRIORITY="optional"
PKG_SHORTDESC="Rsyslog: a rocket-fast system for log processing."
PKG_LONGDESC="Rsyslog ($PKG_VERSION) offers high-performance, great security features and a modular design."
PKG_AUTORECONF="yes"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Rsyslog"
PKG_ADDON_TYPE="xbmc.service"
PKG_ADDON_REPOVERSION="8.0"
PKG_CONFIGURE_OPTS_TARGET="--enable-imfile \
--enable-imjournal \
ac_cv_func_malloc_0_nonnull=yes \
ac_cv_func_realloc_0_nonnull=yes"
export LIBGCRYPT_CONFIG="$SYSROOT_PREFIX/usr/bin/libgcrypt-config"
makeinstall_target() {
:
}
addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
cp $PKG_BUILD/.$TARGET_NAME/tools/rsyslogd \
$ADDON_BUILD/$PKG_ADDON_ID/bin/
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/rsyslog
for l in $(find $PKG_BUILD/.$TARGET_NAME -name *.so)
do
cp $l $ADDON_BUILD/$PKG_ADDON_ID/lib/rsyslog/
done
}

View File

@ -0,0 +1,34 @@
#!/bin/sh
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2016 Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
. /etc/profile
oe_setup_addon service.rsyslog
[ "$RSYSLOG_MANUAL" == "true" ] && exit
(
if [ ! -z "$RSYSLOG_IP_NAME_FQDN" ]
then
cat "$ADDON_DIR/config/common.conf"
[ "$RSYSLOG_JOURNAL_LOGGING" == "true" ] && cat "$ADDON_DIR/config/journal.conf"
[ "$RSYSLOG_KODI_LOGGING" == "true" ] && cat "$ADDON_DIR/config/kodi.conf"
[ "$RSYSLOG_PROTOCOL" == "UDP" ] && PROTOCOL="@" || PROTOCOL="@@"
echo "*.* $PROTOCOL$RSYSLOG_IP_NAME_FQDN:$RSYSLOG_PORT"
fi
) > "$ADDON_HOME/rsyslog.conf"

View File

@ -0,0 +1,6 @@
$ModLoad imuxsock
$OmitLocalLogging on
$AddUnixListenSocket /run/systemd/journal/syslog
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$WorkDirectory /storage/.kodi/temp

View File

@ -0,0 +1,3 @@
$ModLoad imjournal
$ModLoad imklog

View File

@ -0,0 +1,65 @@
$ModLoad imfile
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity emerg
$InputFileFacility local0
$InputRunFileMonitor
$InputFilePersistStateInterval 1
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity alert
$InputFileFacility local1
$InputRunFileMonitor
$InputFilePersistStateInterval 1
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity crit
$InputFileFacility local2
$InputRunFileMonitor
$InputFilePersistStateInterval 1
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity error
$InputFileFacility local3
$InputRunFileMonitor
$InputFilePersistStateInterval 1
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity warning
$InputFileFacility local4
$InputRunFileMonitor
$InputFilePersistStateInterval 1
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity notice
$InputFileFacility local5
$InputRunFileMonitor
$InputFilePersistStateInterval 1
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity info
$InputFileFacility local6
$InputRunFileMonitor
$InputFilePersistStateInterval 1
$InputFileName /storage/.kodi/temp/kodi.log
$InputFileTag kodi
$InputFileStateFile kodi
$InputFileSeverity debug
$InputFileFacility local7
$InputRunFileMonitor
$InputFilePersistStateInterval 1

View File

@ -0,0 +1,35 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2016 Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
import subprocess
import xbmc
import xbmcaddon
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
self.id = xbmcaddon.Addon().getAddonInfo('id')
def onSettingsChanged(self):
subprocess.call(['systemctl', 'restart', self.id])
if __name__ == "__main__":
Monitor().waitForAbort()

View File

@ -0,0 +1,32 @@
# Kodi Media Center language file
# Addon Name: service.rsyslog
msgid ""
msgstr ""
msgctxt "#30000"
msgid "Configuration"
msgstr ""
msgctxt "#30001"
msgid "Configure rsyslog.conf manually"
msgstr ""
msgctxt "#30002"
msgid "IP | Name | FQDN"
msgstr ""
msgctxt "#30003"
msgid "Port"
msgstr ""
msgctxt "#30004"
msgid "Protocol"
msgstr ""
msgctxt "#30005"
msgid "Log journal and kernel"
msgstr ""
msgctxt "#30006"
msgid "Log Kodi"
msgstr ""

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30000">
<setting label="30001" type="bool" id="RSYSLOG_MANUAL" default="false" />
<setting label="30002" type="text" id="RSYSLOG_IP_NAME_FQDN" visible="eq(-1,false)" />
<setting label="30003" type="number" id="RSYSLOG_PORT" default="514" visible="eq(-2,false)" />
<setting label="30004" type="labelenum" id="RSYSLOG_PROTOCOL" lvalues="UDP|TCP" visible="eq(-3,false)" />
<setting label="30005" type="bool" id="RSYSLOG_JOURNAL_LOGGING" default="false" visible="eq(-4,false)" />
<setting label="30006" type="bool" id="RSYSLOG_KODI_LOGGING" default="true" visible="eq(-5,false)" />
</category>
</settings>

View File

@ -0,0 +1,8 @@
<settings>
<setting id="RSYSLOG_IP_NAME_FQDN" value=""/>
<setting id="RSYSLOG_JOURNAL_LOGGING" value="false"/>
<setting id="RSYSLOG_KODI_LOGGING" value="true"/>
<setting id="RSYSLOG_MANUAL" value="false"/>
<setting id="RSYSLOG_PORT" value="514"/>
<setting id="RSYSLOG_PROTOCOL" value="UDP"/>
</settings>

View File

@ -0,0 +1,16 @@
[Unit]
Description=System Logging Service
Requires=syslog.socket
Documentation=http://www.rsyslog.com/doc/
[Service]
Type=notify
Environment=RSYSLOG_MODDIR=/storage/.kodi/addons/service.rsyslog/lib/rsyslog/
ExecStartPre=/bin/sh /storage/.kodi/addons/service.rsyslog/bin/rsyslog.init
ExecStart=/storage/.kodi/addons/service.rsyslog/bin/rsyslogd -n -f /storage/.kodi/userdata/addon_data/service.rsyslog/rsyslog.conf
StandardOutput=null
Restart=on-failure
[Install]
WantedBy=kodi.target
Alias=syslog.service