first commit

This commit is contained in:
Maxim Malakhov committed 2024-09-30 16:22:59 +03:00
commit 375312784b
14 files changed
+153764

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
FROM debian:stable
RUN ( \
export DEBIAN_FRONTEND=noninteractive; \
export BUILD_DEPS=""; \
export APP_DEPS="rsyslog rsyslog-elasticsearch rsyslog-gnutls rsyslog-kafka"; \
set -e -u -x; \
apt-get update; \
apt-get install -y --no-install-recommends ${APP_DEPS} ${BUILD_DEPS}; \
#apt-get remove -y $BUILD_DEPS; \
apt-get clean autoclean; \
apt-get autoremove --yes; \
rm -rf /var/lib/apt /var/lib/dpkg /var/lib/cache /var/lib/log; \
)
COPY conf/rsyslog.conf /etc/
COPY rsyslog.d/*.conf /etc/rsyslog.d/
VOLUME ["/var/log"]
# UDP listen port
EXPOSE 514/udp
CMD ["/usr/sbin/rsyslogd", "-n"]
# vim: tabstop=4 shiftwidth=4 expandtab:
+62
View File
@@ -0,0 +1,62 @@
# /etc/rsyslog.conf Configuration file for rsyslog.
#
#################
#### MODULES ####
#################
module(load="imuxsock" # needs to be done just once
SysSock.FlowControl="off" # no blocking when queues fillup
SysSock.RateLimit.Interval="0" # turn off rate limiting
SysSock.Unlink="on") # unlink when done
# create and read log messages from /var/run/rsyslog/dev/log
input(type="imuxsock" Socket="/var/run/rsyslog/dev/log" CreatePath="on")
$DebugFile debug.log
$DebugLevel 2
#$ModLoad imklog # provides kernel logging support
#$ModLoad immark # provides --MARK-- message capability
# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
# provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514
###########################
#### GLOBAL DIRECTIVES ####
###########################
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
$ActionFileDefaultTemplate RSYSLOG_FileFormat
# Set the default permissions for all log files.
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
# Filter duplicated messages
$RepeatedMsgReduction off
# Turn off escaping control chars
$EscapeControlCharactersOnReceive on
# This decided the size of each line; beyond that the line is truncated
$MaxMessageSize 4k
# Where to place spool and state files
$WorkDirectory /var/spool/rsyslog
# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf
# Custom added shit
$PreserveFQDN on
+47
View File
@@ -0,0 +1,47 @@
template(name="json-template" type="list") {
constant(value="{")
constant(value="\"@timestamp\":\"") property(name="timereported" dateFormat="rfc3339")
constant(value="\",\"@version\":\"1")
constant(value="\",\"message\":\"") property(name="msg" format="json")
constant(value="\",\"sysloghost\":\"") property(name="hostname")
constant(value="\",\"fromhost-ip\":\"") property(name="fromhost-ip")
constant(value="\",\"severity\":\"") property(name="syslogseverity-text")
constant(value="\",\"facility\":\"") property(name="syslogfacility-text")
constant(value="\",\"programname\":\"") property(name="programname")
constant(value="\",\"procid\":\"") property(name="procid")
constant(value="\",\"syslog-tag\":\"") property(name="syslogtag")
constant(value="\"}\n")
}
# if you experience problems, check:
# http://www.rsyslog.com/troubleshoot
# ### MODULES ####
# module(load="omkafka")
# template(name="json_lines" type="list" option.json="on") {
# constant(value="{")
# constant(value="\"timestamp\":\"") property(name="timereported" dateFormat="rfc3339")
# constant(value="\",\"message\":\"") property(name="msg")
# constant(value="\",\"host\":\"") property(name="hostname")
# constant(value="\",\"severity\":\"") property(name="syslogseverity-text")
# constant(value="\",\"facility\":\"") property(name="syslogfacility-text")
# constant(value="\",\"syslog-tag\":\"") property(name="syslogtag")
# constant(value="\"}")
# }
# main_queue(
# queue.workerthreads="1" # threads to work on the queue
# queue.dequeueBatchSize="1" # max number of messages to process at once
# queue.size="1000" # max queue size
# )
# action(
# broker=["kafka:9092"]
# type="omkafka"
# template="json_lines"
# topic="test_topic_1"
# action.resumeRetryCount="-1"
# action.reportsuspension="on"
# )
+1
View File
@@ -0,0 +1 @@
*.* @logstash01:10514;json-template
+1
View File
@@ -0,0 +1 @@
*.* @logstash01:10514;json-template