Add syslog-ng. Update telegraf
This commit is contained in:
53
syslog-ng/Dockerfile
Executable file
53
syslog-ng/Dockerfile
Executable file
@@ -0,0 +1,53 @@
|
||||
ARG BUILD_FROM
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# Setup base system
|
||||
ARG BUILD_ARCH=amd64
|
||||
|
||||
# Install syslog-ng
|
||||
RUN \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y wget ca-certificates gnupg2 && \
|
||||
wget -qO - https://ose-repo.syslog-ng.com/apt/syslog-ng-ose-pub.asc | gpg --dearmor > /usr/share/keyrings/ose-repo-archive-keyring.gpg && \
|
||||
echo "deb [ signed-by=/usr/share/keyrings/ose-repo-archive-keyring.gpg ] https://ose-repo.syslog-ng.com/apt/ stable debian-testing" | tee --append /etc/apt/sources.list.d/syslog-ng-ose.list && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y libdbd-mysql libdbd-pgsql libdbd-sqlite3 syslog-ng && \
|
||||
rm -fr /tmp/* /var/{cache,log}/* /var/lib/apt/lists/*
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
|
||||
# Expose ports
|
||||
EXPOSE 514/udp 601/tcp 6514/tcp
|
||||
|
||||
# Define HealthCheck
|
||||
HEALTHCHECK --interval=2m --timeout=3s --start-period=30s CMD /usr/sbin/syslog-ng-ctl stats || exit 1
|
||||
|
||||
# Build arguments
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DESCRIPTION
|
||||
ARG BUILD_NAME
|
||||
ARG BUILD_REF
|
||||
ARG BUILD_REPOSITORY
|
||||
ARG BUILD_VERSION
|
||||
|
||||
# Labels
|
||||
LABEL \
|
||||
io.hass.name="${BUILD_NAME}" \
|
||||
io.hass.description="${BUILD_DESCRIPTION}" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="fbonelle" \
|
||||
org.opencontainers.image.title="${BUILD_NAME}" \
|
||||
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
|
||||
org.opencontainers.image.vendor="fbonelle's addons" \
|
||||
org.opencontainers.image.authors="fbonelle" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
org.opencontainers.image.created=${BUILD_DATE} \
|
||||
org.opencontainers.image.revision=${BUILD_REF} \
|
||||
org.opencontainers.image.version=${BUILD_VERSION}
|
||||
6
syslog-ng/build.yaml
Normal file
6
syslog-ng/build.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
build_from:
|
||||
aarch64: ghcr.io/hassio-addons/debian-base/aarch64:5.2.3
|
||||
amd64: ghcr.io/hassio-addons/debian-base/amd64:5.2.3
|
||||
armhf: ghcr.io/hassio-addons/debian-base/armhf:5.2.3
|
||||
armv7: ghcr.io/hassio-addons/debian-base/armv7:5.2.3
|
||||
i386: ghcr.io/hassio-addons/debian-base/i386:5.2.3
|
||||
41
syslog-ng/config.yaml
Normal file
41
syslog-ng/config.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: syslog-ng
|
||||
version: 1.0
|
||||
slug: hassio_syslog_ng
|
||||
description: An addon to add syslog-ng to hassio.
|
||||
url: https://gitea.bonelle-family.dscloud.biz/francois.bonelle/hassio-repo.git
|
||||
init: false
|
||||
arch:
|
||||
- aarch64
|
||||
- amd64
|
||||
- armhf
|
||||
- armv7
|
||||
- i386
|
||||
ports:
|
||||
514/udp: 514
|
||||
601/tcp: 601
|
||||
6514/tcp: 6514
|
||||
hassio_api: true
|
||||
hassio_role: default
|
||||
host_network: true
|
||||
auth_api: true
|
||||
privileged:
|
||||
- SYS_ADMIN
|
||||
apparmor: false
|
||||
map:
|
||||
- config:rw
|
||||
- ssl:rw
|
||||
- addons:rw
|
||||
- backup:rw
|
||||
- share:rw
|
||||
startup: services
|
||||
boot: manual
|
||||
docker_api: true
|
||||
host_pid: true
|
||||
full_access: true
|
||||
options:
|
||||
custom_conf:
|
||||
location: "/config/syslog-ng.conf"
|
||||
schema:
|
||||
custom_conf:
|
||||
location: str
|
||||
8
syslog-ng/rootfs/bin/s6-nuke
Normal file
8
syslog-ng/rootfs/bin/s6-nuke
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Glances
|
||||
# This file turns s6-nuke into a NOOP to prevent total termination
|
||||
# of the host system since the add-on runs in the same PID namespace.
|
||||
# ==============================================================================
|
||||
echo "S6-NUKE: NOOP"
|
||||
exit 0
|
||||
17
syslog-ng/rootfs/etc/cont-init.d/syslog-ng.sh
Normal file
17
syslog-ng/rootfs/etc/cont-init.d/syslog-ng.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: syslog-ng
|
||||
# Configures syslog-ng
|
||||
# ==============================================================================
|
||||
declare hostname
|
||||
bashio::require.unprotected
|
||||
|
||||
readonly CONFIG="/etc/syslog-ng/syslog-ng.conf"
|
||||
|
||||
CUSTOM_CONF=$(bashio::config 'custom_conf.location')
|
||||
|
||||
bashio::log.info "Using custom conf file"
|
||||
rm /etc/syslog-ng/syslog-ng.conf
|
||||
cp "${CUSTOM_CONF}" /etc/syslog-ng/syslog-ng.conf
|
||||
|
||||
bashio::log.info "Finished updating config"
|
||||
1
syslog-ng/rootfs/etc/fix-attrs.d/scripts
Normal file
1
syslog-ng/rootfs/etc/fix-attrs.d/scripts
Normal file
@@ -0,0 +1 @@
|
||||
/etc/syslog-ng/syslog-ng.conf false root 0755 0755
|
||||
8
syslog-ng/rootfs/etc/services.d/telegraf/finish
Normal file
8
syslog-ng/rootfs/etc/services.d/telegraf/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: syslog-ng
|
||||
# ==============================================================================
|
||||
if -n { s6-test $# -ne 0 }
|
||||
if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
10
syslog-ng/rootfs/etc/services.d/telegraf/run
Normal file
10
syslog-ng/rootfs/etc/services.d/telegraf/run
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Example
|
||||
# Runs example1 script
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
bashio::log.info "Starting syslog-ng"
|
||||
|
||||
exec /usr/sbin/syslog-ng -F
|
||||
36
syslog-ng/rootfs/etc/syslog-ng/syslog-ng.conf
Normal file
36
syslog-ng/rootfs/etc/syslog-ng/syslog-ng.conf
Normal file
@@ -0,0 +1,36 @@
|
||||
@version: 3.29
|
||||
|
||||
options {
|
||||
use_dns(no);
|
||||
create_dirs(yes);
|
||||
ts_format(iso);
|
||||
};
|
||||
|
||||
source s_systemd {
|
||||
system();
|
||||
internal();
|
||||
};
|
||||
|
||||
source s_homeassistant {
|
||||
file("/var/log/home-assistant.log" program-override("homeassistant"));
|
||||
};
|
||||
|
||||
destination d_remotesyslog {
|
||||
syslog("192.168.100.254" transport("udp") port("1514"));
|
||||
};
|
||||
|
||||
rewrite r_host {
|
||||
set("homeassistant", value("HOST"));
|
||||
};
|
||||
|
||||
log {
|
||||
source(s_systemd);
|
||||
rewrite(r_host);
|
||||
destination(d_remotesyslog);
|
||||
};
|
||||
|
||||
log {
|
||||
source(s_homeassistant);
|
||||
rewrite(r_host);
|
||||
destination(d_remotesyslog);
|
||||
};
|
||||
15
syslog-ng/run.sh
Executable file
15
syslog-ng/run.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bashio
|
||||
declare hostname
|
||||
bashio::require.unprotected
|
||||
|
||||
readonly CONFIG="/etc/syslog-ng/syslog-ng.conf"
|
||||
|
||||
CUSTOM_CONF=$(bashio::config 'custom_conf.location')
|
||||
|
||||
bashio::log.info "Using custom conf file"
|
||||
rm /etc/syslog-ng/syslog-ng.conf
|
||||
cp "${CUSTOM_CONF}" /etc/syslog-ng/syslog-ng.conf
|
||||
|
||||
bashio::log.info "Finished updating config, Starting syslog-ng"
|
||||
|
||||
telegraf
|
||||
Reference in New Issue
Block a user