###############################################################################################
# This is an example of a primary configuration file for Syslogd2.
# It demonstrates the use of 'softcomments' to provide a usable configuration file for both Syslogd2 and Rsyslog.
#
# Referring to syslogd2's revised comment policies, this file will assume that this file is dedicated to Syslogd2.
#   - It will not precede syslog commands with a 'soft-comment character'.
#   - It will not use soft-comments (all comments will start with a double-hashtag ('##') making them hard-comments.
#
# As a reminder, when command-line options are included in a configuration file, the line must start with a tilde ('~') or it is considered a comment.
#
# Also as a reminder, SoftComment is always 'on' for command-line input.
# A comment will start after the 2nd hashtag or if a tilde is not found at the start of a line.
#	--skip 1  ## This line is a comment (no tilde)
#	--skip 1  ## This line is also a comment (no tilde)
##	~ --skip 1  ## This line is a comment (2 hashtags)
#	~ --skip 1 ## This line is NOT a comment and will be acted upon. (it is a Softcomment)
#	~ --skip 1000 This line was skipped due to the command above. Otherwise it would have been acted upon.
#
###############################################################################################
#---------------------------------------------------------------------------------------------
# Declare an error file ('stderr') and logfile ('stdout') at the top of the file to catch the maxinum number of parsing errors.
#   - The 'stdout' file is used only when an administrator explicitly requests that syslogd2 write data to a file.
# The default parameters for both 'stderr' and 'stdout' keywords are empty strings.
#              ----------------------------------------------------------
#	~ --stderr=/opt2/log/error.log, uid=ed, gid=ed, mode=666, level=7, append
#  --stdout=/opt2/log/stdout.log, uid=ed, gid=ed, mode=666, level=7, append ## This line is a acomment (no tilde)
#---------------------------------------------------------------------------------------------

#---------------------------------------------------------------------------------------------
# The installation should have put the '--systemd' parameter on the command-line in the systemd service file.
#   - This line is here if you want to run syslogd2 manually without remembering to add the command-line option.
#              ----------------------------------------------------------
# This option re-defines the default Linux input socket from /dev/log to /run/systemd/journald/syslog and add the 'NoHost' input option for proper parsing.

# This option may produce a warning in the configuration file if it has already been issued by the service-file.
# It provides a 'safety' for when (if) Syslogd2 is started manually.
#	~ --enable systemd
#---------------------------------------------------------------------------------------------

#---------------------------------------------------------------------------------------------
# --localhosts and --stripdomains are traditional syslog options. The default strings for both entries are empty-strings.
#              ----------------------------------------------------------
#	--localhosts =  --stripdomains =
#---------------------------------------------------------------------------------------------


#---------------------------------------------------------------------------------------------
# The parameter to the '--defaults' option is a comma-separated-list of name=value pairs.
#   - The value may be a space-separated list of integers (as in schedules).
#   - The value may be a semi-colon-separated list of strings. Strings and pathnames may contain spaces.
#   - The value may be a single integer, keyword, or string or other value.
#              ----------------------------------------------------------
# To disable the any timer, set the value to zero. To disable a schedule, set it to 1 entry with a value of zero.
# The following are default values as of Syslogd2 version 1.0.3
#
# Scalar values: (Note configuration settings for features not compiled into a particular binary instance will produce warnings or notifications in the error-file.)
#	 --defaults markinterval = 1h, fileuid=0, filegid=0, filemode=600, maxfilesize=2g, OutputFileCheckInterval = 20m, maxspoolfilesize=20M, spoolfileaction=0, spoolfileage=2h
#	 --defaults kernelreaders=2, logfacility = syslog.notice, polltime=60, userfacility = user.notice, kernelfacility = kernel.notice
#	 --defaults readers = 5, workers = 5, outputworkers = 4, workerlines = 30, outputlines = 30, userworkers = 1, userlines = 5, housekeeping = 4
# String values
#	 --defaults cachefile=cache.dat
#	 --defaults configdir=/etc/syslog.d, spooldir=/var/spool/syslog ## These are default values
# Programmable interrupt assignments. (These are default settings, but demonstrate the actual configuration.
#	 --defaults sighup=rotatefiles, sigint=checkfilters, sigusr1=checksources, sigusr2=checkdestinations
# Schedules -- see documentation for details on the purpose and configuration of schedules. The default is to disable all schedules.
#	 --defaults SourceCheckIntervals = 1m 2m 5m 10m 30m 0, DestinationCheckIntervals = 2m 5m 10m 30m 0, FilterCheckIntervals = 3m 5m 30m 2h 4h



# Set default values for this configuration.
#	~ --defaults fileuid=ed, filegid=ed, filemode=660, ofci = 1h, markinterval = 0
#	~ --defaults SourceCheckIntervals = 1m 2m 5m 10m 30m 0, DestinationCheckIntervals = 2m 5m 10m 30m 0, FilterCheckIntervals = 3m 5m 30m 2h 4h

#---------------------------------------------------------------------------------------------

#---------------------------------------------------------------------------------------------
# ThreadMaps is used to define and allocate resources to threadpools of all types.
# (Note configuration settings for features not compiled into a particular binary instance will produce warnings or notifications in the error-file.)
# Please see the documentation for the types and services each type of threadpool provides as well as where each threadpool 'fits' into a complete configuration.
#              ----------------------------------------------------------
#  Set larger values for default threadpools (input id=0, worker id=0, output id=0);
#	~ --threadmaps input, id=0, q=0, r=6, pollinterval=30;			 worker, id=0, w=10, lines=800;			 output, id=0, w=10, lines=400
#	~ --threadmaps input, id=1, q=1, r=3;									 worker, id=1, w=10, lines=400;			 output, id=1, w=15, lines=300
#	~ --threadmaps input, id=2, q=2, r=3, pollinterval=30;			 worker, id=2, w=15, lines=400;			 output, id=2, w=15, lines=400
#
#	~ --threadmaps kernel, r=6, poll = no
#	~ --threadmaps tailfile, id=0, r=4	## pollinterval=60 is inherited from the global settings
#	~ --threadmaps user, w=4, lines=5
#	~ --threadmaps housekeeping, w=4
#	~ --threadmaps pipe, id=3, q=0, r=4	## pollinterval=60 is inherited from the global settings
#	~ --threadmaps pipe, id=4, q=0, r=4	## pollinterval=60 is inherited from the global settings
##---------------------------------------------------------------------------------------------


#---------------------------------------------------------------------------------------------
#              ----------------------------------------------------------
# Default Settings for global boolean values: [these are comments (no tilde)].
# Global boolean variables that are enabled by default:
#		kernellogging, kernelthreads, tty, IPv4, IPv6, userthreads, userlogging, inet, forwarding, syslog, defaultIP, console
#
# Global boolean variables that are disabled by default:
#		allmsgs, cache, housekeeping, inet, forwarding, dns, NoForcePrintable, ApplicationMode, remote, systemd
#
# Set Global boolean values for operation:
#	~ --enable cache, housekeeping, allmsgs
#	~ --disable syslog  ## Disable the default Linux socket so we can re-define it with an input filter below
#---------------------------------------------------------------------------------------------
#
# Define kernel input with an input-filter. (The file does not actually have to exist, but defining it now allows for creating and updating it at run-time.
#	~ --kernel, filter=filters/kernel.input.filter ## filter files may be assigned even if they don't actually exist yet
#
# Re-Define default inputs with input-filters.
##	~ --tailfile /proc/kmsg, id=2, kernel, polltime=45  ## an alternate method for reading kernel input (if CAP_KERNELTHREADS is not defined or if 'kernelthreads' is disabled)
#-----------------------------------------------------------------------------------------------------------
#	~ --input /run/systemd/journal/syslog, nohost, filter=filters/defLinux.input.filter ## the new definition for the default Linux socket
##	~ --input *, id=2, facility=extra0, ignore=facility, filter=filters/defInet.input.filter ## IP input is disabled so this is entry is moot.
#	~ --input /dev/logstream, id = 1, stream, uid=root, gid=root, mode=666, command, filter=filters/command.input.filter ## a Linux socket for the command-tool (and optionally for data).
#-----------------------------------------------------------------------------------------------------------

# The tailfile statements could be moved into the 50-extended.conf file or a separate 'tailfile-input.conf file', but for now, I'll keep all my inputs together in this file.

# ~ --tailfile /var/log/mysql/mysql.log,         id=-2, nohost, append, facility=extra4 , ignore facility, hostname=mariadb.$h.$d, \
#		filter=filters/mariadb.input.filter
# ~ --tailfile /var/log/mysql/mariadb-slow.log,  id=0, nohost, append, facility=extra5 , ignore facility, hostname=mariadb.$h.$d, \
#			filter=filters/mariadb.slow.input.filter
# ~ --tailfile /var/log/mysql/error.log,         id=0, nohost, append, facility=extra6 , ignore facility, hostname=mariadb.$h.$d, \
#			filter=filters/mariadb.error.input.filter



# Include the output files, separating into separate output threadpools based on filename.
#	~ --Include /etc/syslog.d/70-streams.conf --outputparms  id=2
#	~ --IncludeConfig /etc/syslog.d/60-extended.conf --outputparms  id=1
#	~ --IncludeConfig /etc/syslog.d/50-default.conf --outputparms  id=0
#	~ --IncludeConfig --outputparms id=3 ## any other '*.conf' files created in the 'ConfigDir' directory will go into output-threadpool 3 with global default settings.

#---------------------------------------------------------------------------------------------
# --input /dev/log, filter=filters/defLinux.input.filter  ## --> must be disabled for systemd interoperability (no tilde present)
#---------------------------------------------------------------------------------------------

#---------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------
# This is the effective end-of-file for Syslogd2
#---------------------------------------------------------------------------------------------
#	~ --skip 1000 ## skip the next 1000 lines in this file (or to end-of-file whichever comes first)
#---------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------

#-----------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------

# /etc/rsyslog.conf configuration file for rsyslog
#
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf


#################
#### MODULES ####
#################

module(load="imuxsock") # provides support for local system logging
#module(load="immark")  # provides --MARK-- message capability

# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")

# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")

# provides kernel logging support and enable non-kernel klog messages
module(load="imklog" permitnonkernelfacility="on")

###########################
#### GLOBAL DIRECTIVES ####
###########################

#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Filter duplicated messages
$RepeatedMsgReduction on

#
# Set the default permissions for all log files.
#
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
