Verified Commit 7bc33316 authored by Josef Schlehofer's avatar Josef Schlehofer 💬
Browse files

syslog-ng: add scl.conf and /usr/sbin/logread

Polishing (changed URL, added CPE ID together with LICENSE and so on)

Credits about /usr/sbin/logread belongs to dibdot!
parent 703035a1
......@@ -9,12 +9,18 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=syslog-ng
PKG_VERSION:=3.19.1
PKG_RELEASE:=3
PKG_RELEASE:=5
PKG_LICENSE:=LGPL-2.1+
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:balabit:syslog-ng
PKG_SOURCE_URL:=https://github.com/balabit/syslog-ng/releases/download/syslog-ng-$(PKG_VERSION)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/balabit/syslog-ng/releases/download/$(PKG_NAME)-$(PKG_VERSION)/
PKG_MD5SUM:=5cf931a9d7bead0e6d9a2c65eee8f6005a005878f59aa280f3c4294257ed5178
PKG_BUILD_PARALLEL:=1
PKG_CONFIG_DEPENDS:= \
CONFIG_IPV6 \
......@@ -24,10 +30,10 @@ include $(INCLUDE_DIR)/nls.mk
define Package/syslog-ng3
SECTION:=admin
CATEGORY:=Administration
DEPENDS:=+libpcre +glib2 +libopenssl +libwrap +libpthread +librt +zlib +libdbi +psmisc +libwrap +libjson-c +libcurl +libuuid
DEPENDS:=+libpcre +glib2 +libopenssl +libwrap +libpthread +librt +zlib +libdbi +psmisc +libjson-c +libcurl +libuuid
PROVIDES:=syslog
TITLE:=A powerful syslog daemon
URL:=http://www.balabit.com/network-security/syslog-ng/opensource-logging-system/
URL:=https://www.syslog-ng.com/products/open-source-log-management/
endef
define Package/syslog-ng3/description
......@@ -38,6 +44,8 @@ endef
define Package/syslog-ng3/conffiles
/etc/syslog-ng.conf
/etc/syslog-ng.d/
/etc/scl.conf
endef
define Build/Configure
......@@ -56,24 +64,20 @@ endef
CONFIGURE_ARGS += \
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
--disable-dependency-tracking \
--enable-tcp-wrapper \
--disable-glibtest \
--disable-spoof-source \
--disable-sql \
--disable-java \
--disable-java-modules \
--disable-redis \
--disable-sql \
--disable-python \
--disable-smtp \
--enable-prce \
--disable-linux-caps \
--with-librabbitmq-client=no \
--with-mongoc=no \
--with-jsonc=system \
--enable-json=yes \
--enable-http=yes
--enable-http=yes \
--disable-smtp \
--disable-redis \
--disable-dependency-tracking \
--disable-python \
--disable-java \
--disable-java-modules \
--with-librabbitmq-client=no \
--with-mongoc=no
TARGET_CFLAGS += -std=gnu99
......@@ -82,20 +86,21 @@ CONFIGURE_VARS += \
define Package/syslog-ng3/install
cd $(PKG_BUILD_DIR); make DESTDIR=$(1) install
rm -rf $(1)/usr/lib/pkgconfig $(1)/usr/lib/*.a $(1)/usr/lib/*.la $(1)/usr/lib/syslog-ng/*.la
rm -rf $(1)/etc $(1)/usr/include
rmdir $(1)/var
rm -rf $(1)/usr/lib/libevtlog.so
$(call libtool_remove_files,$(1)) # This removes .la files in folder (including subdirectors) /usr/lib
rm -rf $(1)/usr/lib/pkgconfig \
$(1)/usr/lib/*.a \
$(1)/usr/include \
$(1)/var
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/syslog-ng.init $(1)/etc/init.d/syslog-ng
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/etc/syslog-ng.d
ifdef CONFIG_USE_MUSL
$(INSTALL_DATA) ./files/syslog-ng.conf.musl $(1)/etc/syslog-ng.conf
$(INSTALL_DATA) ./files/syslog-ng.conf.musl $(1)/etc/syslog-ng.conf
else
$(INSTALL_DATA) ./files/syslog-ng.conf $(1)/etc
$(INSTALL_DATA) ./files/syslog-ng.conf $(1)/etc
endif
$(INSTALL_DIR) $(1)/etc/syslog-ng.d
touch $(1)/etc/syslog-ng.d/.keep
$(INSTALL_BIN) ./files/logread $(1)/usr/sbin
endef
define Package/syslog-ng3/postinst
......
#!/bin/sh
# Shell script compatibility wrapper for /usr/sbin/logread
#
# Copyright (C) 2019 Dirk Brenken <dev@brenken.org>
#
# This program 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.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
logfile="/var/log/messages"
if [ ! -f "${logfile}" ]
then
printf "%s\n" "Error: logfile not found!"
exit 2
fi
usage()
{
printf "%s\n" "Usage: logread [options]"
printf "%s\n" "Options:"
printf "%5s %-10s%s\n" "-l" "<count>" "Got only the last 'count' messages"
printf "%5s %-10s%s\n" "-e" "<pattern>" "Filter messages with a regexp"
printf "%5s %-10s%s\n" "-h" "" "Print this help message"
}
if [ -z "${1}" ]
then
cat "${logfile}"
exit 0
else
while [ "${1}" ]
do
case "${1}" in
-l)
shift
count="${1}"
tail -n "${count}" "${logfile}"
exit 0
;;
-e)
shift
pattern="${1}"
grep -E "${pattern}" "${logfile}"
exit 0
;;
-h|*)
usage
exit 1
;;
esac
shift
done
fi
@version:3.10
#############################################################################
# OpenWrt syslog-ng.conf specific file
# which collects all local logs into a single file called /var/log/messages.
# More details about these settings can be found here:
# https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.16/release-notes/global-options
@version: 3.19
@include "scl.conf"
@include "/etc/syslog-ng.d/" # Put any customization files in this directory
options {
chain_hostnames(no);
flush_lines(0);
stats_freq(0);
flush_lines(0);
log_msg_size(65536);
chain_hostnames(no); # Enable or disable the chained hostname format.
create_dirs(yes);
keep_hostname(yes); # Enable or disable hostname rewriting.
log_fifo_size(256); # The number of messages that the output queue can store.
log_msg_size(1024); # Maximum length of a message in bytes.
stats_freq(0); # The period between two STATS messages (sent by syslog-ng, containing statistics about dropped logs) in seconds.
flush_lines(0); # How many lines are flushed to a destination at a time.
use_fqdn(no); # Add Fully Qualified Domain Name instead of short hostname.
};
source src {
......@@ -17,6 +28,19 @@ source kernel {
file("/proc/kmsg" program_override("kernel"));
};
source s_network {
default-network-drivers(
# NOTE: TLS support
#
# the default-network-drivers() source driver opens the TLS
# enabled ports as well, however without an actual key/cert
# pair they will not operate and syslog-ng would display a
# warning at startup.
#
#tls(key-file("/path/to/ssl-private-key") cert-file("/path/to/ssl-cert"))
);
};
filter f_turris_iptables {
not match(".*turris[^:]*: .*" value(MESSAGE) type("posix")) or not level(debug);
};
......@@ -31,5 +55,3 @@ log {
filter(f_turris_iptables);
destination(messages);
};
include "/etc/syslog-ng.d/";
@version:3.10
#############################################################################
# OpenWrt syslog-ng.conf specific file
# which collects all local logs into a single file called /var/log/messages.
# More details about these settings can be found here:
# https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.16/release-notes/global-options
@version: 3.19
@include "scl.conf"
@include "/etc/syslog-ng.d/" # Put any customization files in this directory
options {
chain_hostnames(no);
flush_lines(0);
stats_freq(0);
flush_lines(0);
log_msg_size(65536);
chain_hostnames(no); # Enable or disable the chained hostname format.
create_dirs(yes);
keep_hostname(yes); # Enable or disable hostname rewriting.
log_fifo_size(256); # The number of messages that the output queue can store.
log_msg_size(1024); # Maximum length of a message in bytes.
stats_freq(0); # The period between two STATS messages (sent by syslog-ng, containing statistics about dropped logs) in seconds.
flush_lines(0); # How many lines are flushed to a destination at a time.
use_fqdn(no); # Add Fully Qualified Domain Name instead of short hostname.
};
source src {
internal();
unix-dgram("/dev/log" flags("expect-hostname"));
......@@ -17,6 +29,19 @@ source kernel {
file("/proc/kmsg" program_override("kernel"));
};
source s_network {
default-network-drivers(
# NOTE: TLS support
#
# the default-network-drivers() source driver opens the TLS
# enabled ports as well, however without an actual key/cert
# pair they will not operate and syslog-ng would display a
# warning at startup.
#
#tls(key-file("/path/to/ssl-private-key") cert-file("/path/to/ssl-cert"))
);
};
filter f_turris_iptables {
not match(".*turris[^:]*: .*" value(MESSAGE) type("posix")) or not level(debug);
};
......@@ -25,13 +50,9 @@ destination messages {
file("/var/log/messages" suppress(5) template("${R_YEAR}-${R_MONTH}-${R_DAY} ${R_HOUR}:${R_MIN}:${R_SEC} ${PRIORITY} ${PROGRAM}[${PID}]: ${MSGONLY}\n") log_fifo_size(256));
};
log {
source(src);
source(kernel);
filter(f_turris_iptables);
destination(messages);
};
include "/etc/syslog-ng.d/";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment