Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ef275e8 authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

feat(syslog): log locally with rotation

parent d8dc1079
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
/var/log/nextcloud/nextcloud-syslog.log {
    size 16M
    rotate 5
    missingok
    notifempty
    compress
    delaycompress
    copytruncate
    create 0644 root root
}
+11 −0
Original line number Diff line number Diff line
@@ -5,6 +5,16 @@ source s_local {
    internal();
};

destination d_local {
    file(
        "/var/log/nextcloud/nextcloud-syslog.log"
        create-dirs(yes)
        dir-perm(0755)
        perm(0644)
        template("$ISODATE $HOST $PROGRAM[$PID]: $MSG\n")
    );
};

filter f_nextcloud {
    program("${NEXTCLOUD_SYSLOG_TAG}");
};
@@ -26,5 +36,6 @@ destination d_remote {
log {
    source(s_local);
    filter(f_nextcloud);
    destination(d_local);
    destination(d_remote);
};
+9 −0
Original line number Diff line number Diff line
@@ -10,6 +10,15 @@ if [ -n "${SYSLOG_HOST}" ]; then
    /etc/syslog-ng/syslog-ng.conf
  syslog-ng --no-caps
  echo "syslog-ng started."

  # Rotate local syslog-ng file output (max 16MB) hourly
  if command -v logrotate >/dev/null 2>&1 && [ -f /etc/logrotate.conf ]; then
    ( while true; do
        logrotate /etc/logrotate.conf || true
        sleep "${LOGROTATE_INTERVAL:-3600}"
      done ) &
    echo "logrotate timer started."
  fi
fi

/entrypoint.sh "$@"
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ RUN rm -rf ${BASE_DIR}/core/skeleton/* ${BASE_DIR}/themes/example \
 && mkdir -p ${BASE_DIR}/themes/Murena
COPY --chown=www-data:www-data samples/onlyoffice/ ${BASE_DIR}/core/skeleton/Documents/

RUN apt-get update && apt-get install -y unzip ffmpeg syslog-ng
RUN apt-get update && apt-get install -y unzip ffmpeg syslog-ng logrotate

# Murena apps
RUN curl -sL ${CONTACTS_URL} | tar xzf - -C ${BASE_DIR}/custom_apps
@@ -64,6 +64,7 @@ RUN rsync -rLDog --chown www-data:www-data --delete --exclude-from=/upgrade.excl
 && rsync -rLDog --chown www-data:www-data --include "version.php" --include "/custom_apps/" --include "/themes/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/

COPY config/syslog-ng/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
COPY config/logrotate/nextcloud-syslog-ng /etc/logrotate.d/nextcloud-syslog-ng

ENTRYPOINT ["/custom_entrypoint-slim.sh"]
CMD ["php-fpm"]