Package init
This commit is contained in:
commit
6ffeb528d2
@ -0,0 +1,166 @@
|
||||
From 71e9b4eda329fc9e59fbbcdc86353a7609f8d383 Mon Sep 17 00:00:00 2001
|
||||
From: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
Date: Tue, 26 Feb 2019 23:33:08 +0000
|
||||
Subject: [PATCH] add configuration to avoid memory leak for bugfix of rsyslog-7.4.7
|
||||
|
||||
reason: add configuration to avoid memory leak for bugfix of rsyslog-7.4.7
|
||||
|
||||
Signed-off-by: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
---
|
||||
action.c | 7 ++++++-
|
||||
runtime/queue.c | 30 +++++++++++++++++++++++++++++-
|
||||
runtime/queue.h | 2 ++
|
||||
3 files changed, 37 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/action.c b/action.c
|
||||
index 1bc0ad2..e973f72 100644
|
||||
--- a/action.c
|
||||
+++ b/action.c
|
||||
@@ -174,6 +174,7 @@ typedef struct configSettings_s {
|
||||
int iActionQWrkMinMsgs; /* minimum messages per worker needed to start a new one */
|
||||
int bActionQSaveOnShutdown; /* save queue on shutdown (when DA enabled)? */
|
||||
int64 iActionQueMaxDiskSpace; /* max disk space allocated 0 ==> unlimited */
|
||||
+ int64 iActionQueDiskSpaceMark; /* rsyslog cannot run out of disk space */
|
||||
int iActionQueueDeqSlowdown; /* dequeue slowdown (simple rate limiting) */
|
||||
int iActionQueueDeqtWinFromHr; /* hour begin of time frame when queue is to be dequeued */
|
||||
int iActionQueueDeqtWinToHr; /* hour begin of time frame when queue is to be dequeued */
|
||||
@@ -309,7 +310,8 @@ actionResetQueueParams(void)
|
||||
cs.iActionQtoWrkShutdown = 60000; /* timeout for worker thread shutdown */
|
||||
cs.iActionQWrkMinMsgs = -1; /* minimum messages per worker needed to start a new one */
|
||||
cs.bActionQSaveOnShutdown = 1; /* save queue on shutdown (when DA enabled)? */
|
||||
- cs.iActionQueMaxDiskSpace = 0;
|
||||
+ cs.iActionQueMaxDiskSpace = 100*1024*1024;
|
||||
+ cs.iActionQueDiskSpaceMark = 100*1024*1024;
|
||||
cs.iActionQueueDeqSlowdown = 0;
|
||||
cs.iActionQueueDeqtWinFromHr = 0;
|
||||
cs.iActionQueueDeqtWinToHr = 25; /* 25 disables time windowed dequeuing */
|
||||
@@ -543,6 +545,7 @@ actionConstructFinalize(action_t *__restrict__ const pThis, struct nvlst *lst)
|
||||
error %d. Ignored, running with default setting", iRet); \
|
||||
}
|
||||
setQPROP(qqueueSetsizeOnDiskMax, "$ActionQueueMaxDiskSpace", cs.iActionQueMaxDiskSpace);
|
||||
+ setQPROP(qqueueSetsizeOnDiskMrk, "$ActionQueueDiskSpaceMark", cs.iActionQueDiskSpaceMark);
|
||||
setQPROP(qqueueSetiDeqBatchSize, "$ActionQueueDequeueBatchSize", cs.iActionQueueDeqBatchSize);
|
||||
setQPROP(qqueueSetMaxFileSize, "$ActionQueueFileSize", cs.iActionQueMaxFileSize);
|
||||
setQPROPstr(qqueueSetFilePrefix, "$ActionQueueFileName", cs.pszActionQFName);
|
||||
@@ -2229,6 +2232,8 @@ rsRetVal actionClassInit(void)
|
||||
&cs.iActionQueueDeqBatchSize, NULL));
|
||||
CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuemaxdiskspace", 0, eCmdHdlrSize, NULL,
|
||||
&cs.iActionQueMaxDiskSpace, NULL));
|
||||
+ CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuediskspacemark", 0, eCmdHdlrSize, NULL,
|
||||
+ &cs.iActionQueDiskSpaceMark, NULL));
|
||||
CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuehighwatermark", 0, eCmdHdlrInt, NULL,
|
||||
&cs.iActionQHighWtrMark, NULL));
|
||||
CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuelowwatermark", 0, eCmdHdlrInt, NULL,
|
||||
diff --git a/runtime/queue.c b/runtime/queue.c
|
||||
index 23de366..0c2485c 100644
|
||||
--- a/runtime/queue.c
|
||||
+++ b/runtime/queue.c
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
+#include <sys/vfs.h>
|
||||
|
||||
#include "rsyslog.h"
|
||||
#include "queue.h"
|
||||
@@ -125,6 +126,7 @@ static struct cnfparamdescr cnfpdescr[] = {
|
||||
{ "queue.mindequeuebatchsize", eCmdHdlrInt, 0 },
|
||||
{ "queue.mindequeuebatchsize.timeout", eCmdHdlrInt, 0 },
|
||||
{ "queue.maxdiskspace", eCmdHdlrSize, 0 },
|
||||
+ { "queue.diskspacemark", eCmdHdlrSize, 0 },
|
||||
{ "queue.highwatermark", eCmdHdlrInt, 0 },
|
||||
{ "queue.lowwatermark", eCmdHdlrInt, 0 },
|
||||
{ "queue.fulldelaymark", eCmdHdlrInt, 0 },
|
||||
@@ -472,6 +474,7 @@ StartDA(qqueue_t *pThis)
|
||||
|
||||
CHKiRet(qqueueSetpAction(pThis->pqDA, pThis->pAction));
|
||||
CHKiRet(qqueueSetsizeOnDiskMax(pThis->pqDA, pThis->sizeOnDiskMax));
|
||||
+ CHKiRet(qqueueSetsizeOnDiskMrk(pThis->pqDA, pThis->sizeOnDiskMrk));
|
||||
CHKiRet(qqueueSetiDeqSlowdown(pThis->pqDA, pThis->iDeqSlowdown));
|
||||
CHKiRet(qqueueSetMaxFileSize(pThis->pqDA, pThis->iMaxFileSize));
|
||||
CHKiRet(qqueueSetFilePrefix(pThis->pqDA, pThis->pszFilePrefix, pThis->lenFilePrefix));
|
||||
@@ -1016,6 +1019,20 @@ qAddDisk(qqueue_t *const pThis, smsg_t* pMsg)
|
||||
ISOBJ_TYPE_assert(pMsg, msg);
|
||||
number_t nWriteCount;
|
||||
const int oldfile = strmGetCurrFileNum(pThis->tVars.disk.pWrite);
|
||||
+ struct statfs stDiskInfo;
|
||||
+ unsigned long long ullFreeDisk = 0;
|
||||
+
|
||||
+ /* rsyslog cannot run out of disk space:start */
|
||||
+ iRet = statfs(pThis->pszSpoolDir, &stDiskInfo);
|
||||
+ if (iRet != 0||&stDiskInfo == NULL){
|
||||
+ FINALIZE;
|
||||
+ }
|
||||
+ ullFreeDisk = stDiskInfo.f_bsize * stDiskInfo.f_bfree;
|
||||
+ if ( ullFreeDisk < pThis->sizeOnDiskMrk ){
|
||||
+ iRet = RS_RET_WRN_WRKDIR;
|
||||
+ FINALIZE;
|
||||
+ }
|
||||
+ /* rsyslog cannot run out of disk space:end */
|
||||
|
||||
CHKiRet(strm.SetWCntr(pThis->tVars.disk.pWrite, &nWriteCount));
|
||||
CHKiRet((objSerialize(pMsg))(pMsg, pThis->tVars.disk.pWrite));
|
||||
@@ -1047,6 +1064,13 @@ qAddDisk(qqueue_t *const pThis, smsg_t* pMsg)
|
||||
}
|
||||
|
||||
finalize_it:
|
||||
+ if(iRet != RS_RET_OK){
|
||||
+ DBGOPRINT((obj_t*) pThis, "cannot write to disk, queue disk size now %lld octets, EnqOnly:%d\n",
|
||||
+ pThis->tVars.disk.sizeOnDisk, pThis->bEnqOnly);
|
||||
+
|
||||
+ if(pMsg != NULL)
|
||||
+ msgDestruct(&pMsg);
|
||||
+ }
|
||||
RETiRet;
|
||||
}
|
||||
|
||||
@@ -1544,7 +1568,8 @@ qqueueSetDefaultsActionQueue(qqueue_t *pThis)
|
||||
pThis->toWrkShutdown = actq_dflt_toWrkShutdown; /* timeout for worker thread shutdown */
|
||||
pThis->iMinMsgsPerWrkr = -1; /* minimum messages per worker needed to start a new one */
|
||||
pThis->bSaveOnShutdown = 1; /* save queue on shutdown (when DA enabled)? */
|
||||
- pThis->sizeOnDiskMax = 0; /* unlimited */
|
||||
+ pThis->sizeOnDiskMax = 100*1024*1024; /* unlimited */
|
||||
+ pThis->sizeOnDiskMrk = 100*1024*1024;
|
||||
pThis->iDeqSlowdown = 0;
|
||||
pThis->iDeqtWinFromHr = 0;
|
||||
pThis->iDeqtWinToHr = 25; /* disable time-windowed dequeuing by default */
|
||||
@@ -3355,6 +3380,8 @@ qqueueApplyCnfParam(qqueue_t *pThis, struct nvlst *lst)
|
||||
pThis->toMinDeqBatchSize = pvals[i].val.d.n;
|
||||
} else if(!strcmp(pblk.descr[i].name, "queue.maxdiskspace")) {
|
||||
pThis->sizeOnDiskMax = pvals[i].val.d.n;
|
||||
+ } else if(!strcmp(pblk.descr[i].name, "queue.diskspacemark")) {
|
||||
+ pThis->sizeOnDiskMrk = pvals[i].val.d.n;
|
||||
} else if(!strcmp(pblk.descr[i].name, "queue.highwatermark")) {
|
||||
pThis->iHighWtrMrk = pvals[i].val.d.n;
|
||||
} else if(!strcmp(pblk.descr[i].name, "queue.lowwatermark")) {
|
||||
@@ -3455,6 +3482,7 @@ DEFpropSetMeth(qqueue, iDeqBatchSize, int)
|
||||
DEFpropSetMeth(qqueue, iMinDeqBatchSize, int)
|
||||
DEFpropSetMeth(qqueue, sizeOnDiskMax, int64)
|
||||
DEFpropSetMeth(qqueue, iSmpInterval, int)
|
||||
+DEFpropSetMeth(qqueue, sizeOnDiskMrk, int64)
|
||||
|
||||
|
||||
/* This function can be used as a generic way to set properties. Only the subset
|
||||
diff --git a/runtime/queue.h b/runtime/queue.h
|
||||
index 5f91c58..f01c325 100644
|
||||
--- a/runtime/queue.h
|
||||
+++ b/runtime/queue.h
|
||||
@@ -143,6 +143,7 @@ struct queue_s {
|
||||
int iNumberFiles; /* how many files make up the queue? */
|
||||
int64 iMaxFileSize; /* max size for a single queue file */
|
||||
int64 sizeOnDiskMax; /* maximum size on disk allowed */
|
||||
+ int64 sizeOnDiskMrk; /*rsyslog cannot run out of disk space*/
|
||||
qDeqID deqIDAdd; /* next dequeue ID to use during add to queue store */
|
||||
qDeqID deqIDDel; /* queue store delete position */
|
||||
int bIsDA; /* is this queue disk assisted? */
|
||||
@@ -233,6 +234,7 @@ PROTOTYPEpropSetMeth(qqueue, bSaveOnShutdown, int);
|
||||
PROTOTYPEpropSetMeth(qqueue, pAction, action_t*);
|
||||
PROTOTYPEpropSetMeth(qqueue, iDeqSlowdown, int);
|
||||
PROTOTYPEpropSetMeth(qqueue, sizeOnDiskMax, int64);
|
||||
+PROTOTYPEpropSetMeth(qqueue, sizeOnDiskMrk, int64);
|
||||
PROTOTYPEpropSetMeth(qqueue, iDeqBatchSize, int);
|
||||
#define qqueueGetID(pThis) ((unsigned long) pThis)
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
||||
59
bugfix-rsyslog-7.4.7-imjournal-add-monotonic-timestamp.patch
Normal file
59
bugfix-rsyslog-7.4.7-imjournal-add-monotonic-timestamp.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 8645960b76db8ff5986efc60f7d2b77b8c5c0094 Mon Sep 17 00:00:00 2001
|
||||
From: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
Date: Sat, 26 Jan 2019 12:37:59 +0000
|
||||
Subject: [PATCH] add monotonic timestamp for bugfix of rsyslog-7.4.7 imjournal
|
||||
|
||||
reason: add monotonic timestamp for bugfix of rsyslog-7.4.7 imjournal
|
||||
|
||||
Signed-off-by: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
---
|
||||
plugins/imjournal/imjournal.c | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
|
||||
index 4396ddd..ffafa1f 100644
|
||||
--- a/plugins/imjournal/imjournal.c
|
||||
+++ b/plugins/imjournal/imjournal.c
|
||||
@@ -281,6 +281,7 @@ readjournal(void)
|
||||
|
||||
struct timeval tv;
|
||||
uint64_t timestamp;
|
||||
+ uint64_t monotonic_timestamp;
|
||||
|
||||
struct json_object *json = NULL;
|
||||
int r;
|
||||
@@ -291,6 +292,9 @@ readjournal(void)
|
||||
char *sys_iden_help = NULL;
|
||||
char *c = NULL;
|
||||
|
||||
+ char *t;
|
||||
+ char *tpmessage;
|
||||
+
|
||||
const void *get;
|
||||
const void *pidget;
|
||||
size_t length;
|
||||
@@ -443,8 +447,19 @@ readjournal(void)
|
||||
}
|
||||
}
|
||||
|
||||
- /* submit message */
|
||||
- enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
|
||||
+ if (sd_journal_get_data(j, "_SOURCE_MONOTONIC_TIMESTAMP", &get, &length) >= 0)
|
||||
+ {
|
||||
+ t = strndup(get+28, length-28);
|
||||
+ monotonic_timestamp = atoll(t);
|
||||
+ free(t);
|
||||
+ tpmessage = (char *)malloc(strlen(message)+30);
|
||||
+ int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
|
||||
+ memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
|
||||
+ enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
|
||||
+ free(tpmessage);
|
||||
+ }else
|
||||
+ /* submit message */
|
||||
+ enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
|
||||
|
||||
finalize_it:
|
||||
free(sys_iden_help);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
93
os_check_timezone_for_rsyslog.sh
Normal file
93
os_check_timezone_for_rsyslog.sh
Normal file
@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOCK_FILE=/var/lock/os_check_timezone_change.lock
|
||||
exec 200<>$LOCK_FILE
|
||||
flock -nx 200
|
||||
if [ $? -ne 0 ];then
|
||||
echo "$0 is running, can not run it twice at one time" >/dev/kmsg
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILE_TMP="/etc/localtime_tmp"
|
||||
OLD_TIME_ZONE=""
|
||||
|
||||
fn_is_container_pid()
|
||||
{
|
||||
#test whether the specified pid is a process in container from host.
|
||||
#a process is in container if its namespace is not same as pid1.
|
||||
local pid="$1"
|
||||
local ns_pid1=/proc/1/ns/pid
|
||||
local ns_target=/proc/$pid/ns/pid
|
||||
local -i ret=0 #default to false
|
||||
if [ -f "$ns_pid1" -a -f "$ns_target" ] ; then
|
||||
ns_pid1=$(readlink -sn "$ns_pid1")
|
||||
ns_target=$(readlink -sn "$ns_target")
|
||||
if [ "$ns_pid1" != "$ns_target" ] ; then
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
#kill process on the host instead of the container
|
||||
fn_container_protect_kill()
|
||||
{
|
||||
local pid="$1"
|
||||
local signal="${2:-"TERM"}"
|
||||
local cmdline_part="${3:-""}"
|
||||
|
||||
if [ -d "/proc/$pid" ] ; then
|
||||
fn_is_container_pid "$pid"
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ -n "$cmdline_part" ] ; then
|
||||
full_cmdline=$(xargs -0 <"/proc/$pid/cmdline" 2>/dev/null)
|
||||
if [[ "$full_cmdline" == *"$cmdline_part"* ]] ; then
|
||||
#kill only when cmdline matches
|
||||
kill -$signal $pid
|
||||
fi
|
||||
else
|
||||
kill -$signal $pid
|
||||
fi
|
||||
else
|
||||
echo "pid [$pid] is a process from container or has already terminated, do not kill." >/dev/kmsg
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#Restart rsyslog and cron services
|
||||
fn_restart_syslog_and_cron()
|
||||
{
|
||||
|
||||
local rsyslogd_path="/usr/sbin/rsyslogd"
|
||||
|
||||
systemctl restart rsyslog
|
||||
systemctl restart crond
|
||||
#ensure there is only rsyslog instance after restarting
|
||||
for (( i=0;i<3;i++ ));do
|
||||
sleep 2
|
||||
pids=(`/usr/sbin/pidof ${rsyslogd_path}`)
|
||||
num=${#pids[@]}
|
||||
if [ "$num" -eq "1" ];then
|
||||
return 0
|
||||
elif [ "$num" -gt "1" ];then
|
||||
echo "fn_restart_syslog ret:$num, do killall syslog...." >/dev/kmsg
|
||||
for ((i=0;i<num;i++));do
|
||||
fn_container_protect_kill "${pids[${i}]}" kill "${rsyslogd_path}"
|
||||
done
|
||||
systemctl start rsyslog
|
||||
else
|
||||
systemctl start rsyslog
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ -f ${FILE_TMP} ];then
|
||||
OLD_TIME_ZONE=`cat ${FILE_TMP}`
|
||||
timezone=`date +%Z%z`
|
||||
if [ "$timezone" != "$OLD_TIME_ZONE" ];then
|
||||
echo "timezone changed....new ${timezone} old ${OLD_TIME_ZONE}" >/dev/kmsg
|
||||
fn_restart_syslog_and_cron
|
||||
fi
|
||||
fi
|
||||
date +%Z%z > ${FILE_TMP}
|
||||
102
os_rotate_and_save_log.sh
Normal file
102
os_rotate_and_save_log.sh
Normal file
@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
###########################################################################
|
||||
#File Name:os_rotate_and_save_log.sh
|
||||
#Description: Save the source file to destination directories by size
|
||||
#Parameter: It is a character string, has three values.
|
||||
# parameter one, the file which needs to be saved.
|
||||
# parameter two, the destination directory for saving the file.
|
||||
# parameter three, logdump dir limit size
|
||||
#Output:none
|
||||
###########################################################################
|
||||
|
||||
CUR_SCRIPT=$0
|
||||
PID=$(pidof -x $CUR_SCRIPT)
|
||||
L_CUR_SCRIPT_RUNNING_COUNT=$(echo "$PID" | wc -w)
|
||||
|
||||
#can not be runned twice at the same time
|
||||
if [ "${L_CUR_SCRIPT_RUNNING_COUNT}" -gt 1 ];then
|
||||
echo "[$CUR_SCRIPT] $CUR_SCRIPT is running, can not run it twice at one time" >/dev/kmsg
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#parse parameter
|
||||
declare -a PARAM_ARRAY
|
||||
PARAM_ARRAY=($1)
|
||||
SRC_FILE=${PARAM_ARRAY[0]}
|
||||
DEST_DIR=${PARAM_ARRAY[1]}
|
||||
DIR_LIMIT_SIZE=${PARAM_ARRAY[2]}
|
||||
FILE_NAME=${SRC_FILE##*/}
|
||||
|
||||
#get the maximum serial number
|
||||
SERIEL_NUM=`ls $DEST_DIR|grep "messages-.*-.*\.tar\.bz2"|cut -d '-' -f3 |sort -nr|head -n1|cut -d '.' -f1`
|
||||
if [ -z $SERIEL_NUM ];then
|
||||
SERIEL_NUM=0
|
||||
fi
|
||||
((SERIEL_NUM=$SERIEL_NUM+1))
|
||||
|
||||
TMPNAME=${FILE_NAME}-`date "+%Y%m%d%H%M%S"-${SERIEL_NUM}`
|
||||
TMPFILE=/tmp/$TMPNAME
|
||||
|
||||
#create destination directory
|
||||
if [ ! -d "$DEST_DIR" ];then
|
||||
mkdir -p $DEST_DIR
|
||||
fi
|
||||
|
||||
#save the log file to /tmp/
|
||||
mv $SRC_FILE $TMPFILE
|
||||
|
||||
#count the maximum number of bytes in the destination directory
|
||||
DIR_LIMIT_SIZE_NUM=${DIR_LIMIT_SIZE%[A-Z|a-z]}
|
||||
DIR_LIMIT_SIZE_UNIT=${DIR_LIMIT_SIZE##[0-9]*[0-9]}
|
||||
|
||||
case $DIR_LIMIT_SIZE_UNIT in
|
||||
M|m)
|
||||
DIR_LIMIT_SIZE_NUM=$((DIR_LIMIT_SIZE_NUM*1024*1024))
|
||||
;;
|
||||
K|k)
|
||||
DIR_LIMIT_SIZE_NUM=$((DIR_LIMIT_SIZE_NUM*1024))
|
||||
;;
|
||||
esac
|
||||
|
||||
TAR_PKG_NAME=$TMPFILE.tar.bz2
|
||||
cd /tmp
|
||||
tar -cjf $TAR_PKG_NAME $TMPNAME
|
||||
cd -
|
||||
|
||||
#count current dump file size
|
||||
FILE_SIZE=`du -sb $TAR_PKG_NAME|awk '{print $1}'`
|
||||
#count the maximum space that a file can occupy in the destination directory if it is to accommodate the current dump file.
|
||||
((MAX_LEFT_SIZE=$DIR_LIMIT_SIZE_NUM-$FILE_SIZE))
|
||||
|
||||
#current total size of files
|
||||
pushd $DEST_DIR >/dev/null
|
||||
cursize=`du -sb|awk '{print $1}'`
|
||||
#delete extraneous files when there is not enough space
|
||||
if [ "$cursize" -gt "$MAX_LEFT_SIZE" ];then
|
||||
irrelevant_files=`find $DEST_DIR|grep -v "^$DEST_DIR/$FILE_NAME-.*-.*\.tar\.bz2$" |grep -v "^$DEST_DIR$"`
|
||||
if [ "$irrelevant_files" != "" ];then
|
||||
rm -rf $irrelevant_files
|
||||
echo "[$0]space of output directory $DEST_DIR will be larger than $DIR_LIMIT_SIZE bytes,delete the irrelevant files :$irrelevant_files" >/dev/kmsg
|
||||
cursize=`du -sb|awk '{print $1}'`
|
||||
fi
|
||||
fi
|
||||
|
||||
#when the space is still insufficient, delete the oldest log package one by one until it can hold the latest log package
|
||||
while [ $cursize -gt $MAX_LEFT_SIZE ]
|
||||
do
|
||||
del_file=`ls $DEST_DIR|grep "$FILE_NAME-.*-.*\.tar\.bz2"|cut -d '-' -f3|sort -n|head -n1`
|
||||
if [[ $del_file == "" ]];then
|
||||
break
|
||||
fi
|
||||
del_file=`ls|grep "$FILE_NAME-.*-$del_file"`
|
||||
echo "[$0]space of output directory is larger than $DIR_LIMIT_SIZE bytes,delete the oldest tar file $del_file" >/dev/kmsg
|
||||
rm -rf $del_file
|
||||
|
||||
cursize=`du -sb|awk '{print $1}'`
|
||||
done
|
||||
popd >/dev/null
|
||||
|
||||
mv $TAR_PKG_NAME $DEST_DIR
|
||||
rm -rf $TMPFILE
|
||||
|
||||
exit 0
|
||||
BIN
rsyslog-8.1907.0.tar.gz
Normal file
BIN
rsyslog-8.1907.0.tar.gz
Normal file
Binary file not shown.
@ -0,0 +1,35 @@
|
||||
From 4196f125b63ad889c071b25a6a72176be2e31f65 Mon Sep 17 00:00:00 2001
|
||||
From: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
Date: Sat, 26 Jan 2019 12:21:02 +0000
|
||||
Subject: [PATCH] rsyslog-8.24.0, ensure parent dir exists when writting log file
|
||||
|
||||
reason: rsyslog-8.24.0, ensure parent dir exists when writting log file
|
||||
|
||||
Signed-off-by: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
---
|
||||
tools/omfile.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/omfile.c b/tools/omfile.c
|
||||
index c1a5615..30d792a 100644
|
||||
--- a/tools/omfile.c
|
||||
+++ b/tools/omfile.c
|
||||
@@ -805,7 +805,14 @@ doWrite(instanceData *__restrict__ const pData, uchar *__restrict__ const pszBuf
|
||||
|
||||
DBGPRINTF("omfile: write to stream, pData->pStrm %p, lenBuf %d, strt data %.128s\n",
|
||||
pData->pStrm, lenBuf, pszBuf);
|
||||
- if(pData->pStrm != NULL){
|
||||
+ if(pData->pStrm != NULL) {
|
||||
+ if(pData->pStrm->fd == -1 && access((char*)pData->fname, F_OK)) {
|
||||
+ if(makeFileParentDirs(pData->fname, ustrlen(pData->fname),
|
||||
+ pData->fDirCreateMode, pData->dirUID,
|
||||
+ pData->dirGID, pData->bFailOnChown) != 0) {
|
||||
+ ABORT_FINALIZE(RS_RET_ERR); /* we give up */
|
||||
+ }
|
||||
+ }
|
||||
CHKiRet(strm.Write(pData->pStrm, pszBuf, lenBuf));
|
||||
if(pData->useSigprov) {
|
||||
CHKiRet(pData->sigprov.OnRecordWrite(pData->sigprovFileData, pszBuf, lenBuf));
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
From 80b2f2cb20cd72b4ce5e2d646f2fa9d6abd3f31d Mon Sep 17 00:00:00 2001
|
||||
From: liufeng <liufeng111@huawei.com>
|
||||
Date: Mon, 1 Jul 2019 12:20:02 +0800
|
||||
Subject: [PATCH] initialize variables and check return value to eliminate warnings
|
||||
|
||||
reason: initialize variables and check return value to eliminate warnings
|
||||
|
||||
Signed-off-by: liufeng <liufeng111@huawei.com>
|
||||
---
|
||||
plugins/imjournal/imjournal.c | 22 +++++++++++++---------
|
||||
tools/rsyslogd.c | 2 +-
|
||||
2 files changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
|
||||
index 2eb42a6..87c251a 100644
|
||||
--- a/plugins/imjournal/imjournal.c
|
||||
+++ b/plugins/imjournal/imjournal.c
|
||||
@@ -281,7 +281,7 @@ readjournal(void)
|
||||
|
||||
struct timeval tv;
|
||||
uint64_t timestamp;
|
||||
- uint64_t monotonic_timestamp;
|
||||
+ uint64_t monotonic_timestamp = 0;
|
||||
|
||||
struct json_object *json = NULL;
|
||||
int r;
|
||||
@@ -292,8 +292,8 @@ readjournal(void)
|
||||
char *sys_iden_help = NULL;
|
||||
char *c = NULL;
|
||||
|
||||
- char *t;
|
||||
- char *tpmessage;
|
||||
+ char *t = NULL;
|
||||
+ char *tpmessage = NULL;
|
||||
|
||||
const void *get;
|
||||
const void *pidget;
|
||||
@@ -450,13 +450,17 @@ readjournal(void)
|
||||
if (sd_journal_get_data(j, "_SOURCE_MONOTONIC_TIMESTAMP", &get, &length) >= 0)
|
||||
{
|
||||
t = strndup(get+28, length-28);
|
||||
- monotonic_timestamp = atoll(t);
|
||||
- free(t);
|
||||
+ if (t != NULL) {
|
||||
+ monotonic_timestamp = atoll(t);
|
||||
+ free(t);
|
||||
+ }
|
||||
tpmessage = (char *)malloc(strlen(message)+30);
|
||||
- int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
|
||||
- memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
|
||||
- enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
|
||||
- free(tpmessage);
|
||||
+ if (tpmessage != NULL) {
|
||||
+ int ret = sprintf(tpmessage,"[%5lu.%06lu] ",monotonic_timestamp/1000000, monotonic_timestamp%1000000);
|
||||
+ memcpy(tpmessage+(ret > 30 ? 0 :(ret < 0 ? 0:ret)),message,strlen(message)+1);
|
||||
+ enqMsg((uchar *)tpmessage, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
|
||||
+ free(tpmessage);
|
||||
+ }
|
||||
}else
|
||||
/* submit message */
|
||||
enqMsg((uchar *)message, (uchar *) sys_iden_help, facility, severity, &tv, json, 0);
|
||||
diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c
|
||||
index 10a8a05..bacc218 100644
|
||||
--- a/tools/rsyslogd.c
|
||||
+++ b/tools/rsyslogd.c
|
||||
@@ -236,7 +236,7 @@ static rsRetVal
|
||||
writePidFile(void)
|
||||
{
|
||||
FILE *fp;
|
||||
- int fd;
|
||||
+ int fd = -1;
|
||||
DEFiRet;
|
||||
|
||||
const char *tmpPidFile;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
BIN
rsyslog-doc-8.1907.0.tar.gz
Normal file
BIN
rsyslog-doc-8.1907.0.tar.gz
Normal file
Binary file not shown.
78
rsyslog.conf
Normal file
78
rsyslog.conf
Normal file
@ -0,0 +1,78 @@
|
||||
# rsyslog configuration file
|
||||
|
||||
# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
|
||||
# or latest version online at http://www.rsyslog.com/doc/rsyslog_conf.html
|
||||
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
|
||||
|
||||
#### GLOBAL DIRECTIVES ####
|
||||
|
||||
# Where to place auxiliary files
|
||||
global(workDirectory="/run/log/journal")
|
||||
|
||||
# Use default timestamp format
|
||||
module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")
|
||||
|
||||
#### MODULES ####
|
||||
|
||||
module(load="imuxsock" # provides support for local system logging (e.g. via logger command)
|
||||
SysSock.Use="off") # Turn off message reception via local log socket;
|
||||
# local messages are retrieved through imjournal now.
|
||||
module(load="imjournal" # provides access to the systemd journal
|
||||
StateFile="imjournal.state") # File to store the position in the journal
|
||||
#module(load="imklog") # reads kernel messages (the same are read from journald)
|
||||
#module(load="immark") # provides --MARK-- message capability
|
||||
|
||||
# Provides UDP syslog reception
|
||||
# for parameters see http://www.rsyslog.com/doc/imudp.html
|
||||
#module(load="imudp") # needs to be done just once
|
||||
#input(type="imudp" port="514")
|
||||
|
||||
# Provides TCP syslog reception
|
||||
# for parameters see http://www.rsyslog.com/doc/imtcp.html
|
||||
#module(load="imtcp") # needs to be done just once
|
||||
#input(type="imtcp" port="514")
|
||||
|
||||
# Include all config files in /etc/rsyslog.d/
|
||||
include(file="/etc/rsyslog.d/*.conf" mode="optional")
|
||||
#### RULES ####
|
||||
|
||||
# Log all kernel messages to the console.
|
||||
# Logging much else clutters up the screen.
|
||||
#kern.* /dev/console
|
||||
|
||||
# Log anything (except mail) of level info or higher.
|
||||
# Don't log private authentication messages!
|
||||
*.info;mail.none;authpriv.none;cron.none /var/log/messages
|
||||
|
||||
# The authpriv file has restricted access.
|
||||
authpriv.* /var/log/secure
|
||||
|
||||
# Log all the mail messages in one place.
|
||||
mail.* -/var/log/maillog
|
||||
|
||||
|
||||
# Log cron stuff
|
||||
cron.* /var/log/cron
|
||||
|
||||
# Everybody gets emergency messages
|
||||
*.emerg :omusrmsg:*
|
||||
|
||||
# Save news errors of level crit and higher in a special file.
|
||||
uucp,news.crit /var/log/spooler
|
||||
|
||||
# Save boot messages also to boot.log
|
||||
local7.* /var/log/boot.log
|
||||
|
||||
|
||||
# ### sample forwarding rule ###
|
||||
#action(type="omfwd"
|
||||
# # An on-disk queue is created for this action. If the remote host is
|
||||
# # down, messages are spooled to disk and sent when it is up again.
|
||||
#queue.filename="fwdRule1" # unique name prefix for spool files
|
||||
#queue.maxdiskspace="1g" # 1gb space limit (use as much as possible)
|
||||
#queue.saveonshutdown="on" # save messages to disk on shutdown
|
||||
#queue.type="LinkedList" # run asynchronously
|
||||
#action.resumeRetryCount="-1" # infinite retries if host is down
|
||||
# # Remote Logging (we use TCP for reliable delivery)
|
||||
# # remote_host is: name/ip, e.g. 192.168.0.1, port optional e.g. 10514
|
||||
#Target="remote_host" Port="XXX" Protocol="tcp")
|
||||
12
rsyslog.log
Normal file
12
rsyslog.log
Normal file
@ -0,0 +1,12 @@
|
||||
/var/log/cron
|
||||
/var/log/maillog
|
||||
/var/log/messages
|
||||
/var/log/secure
|
||||
/var/log/spooler
|
||||
{
|
||||
missingok
|
||||
sharedscripts
|
||||
postrotate
|
||||
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
354
rsyslog.spec
Normal file
354
rsyslog.spec
Normal file
@ -0,0 +1,354 @@
|
||||
%define rsyslog_statedir %{_sharedstatedir}/rsyslog
|
||||
%define rsyslog_pkidir %{_sysconfdir}/pki/rsyslog
|
||||
%define rsyslog_docdir %{_docdir}/rsyslog
|
||||
|
||||
Name: rsyslog
|
||||
Version: 8.1907.0
|
||||
Release: 1
|
||||
Summary: The rocket-fast system for log processing
|
||||
License: (GPLv3+ and ASL 2.0)
|
||||
URL: http://www.rsyslog.com/
|
||||
Source0: http://www.rsyslog.com/files/download/rsyslog/%{name}-%{version}.tar.gz
|
||||
Source1: http://www.rsyslog.com/files/download/rsyslog/%{name}-doc-%{version}.tar.gz
|
||||
Source2: rsyslog.conf
|
||||
Source3: rsyslog.sysconfig
|
||||
Source4: rsyslog.log
|
||||
Source5: os_rotate_and_save_log.sh
|
||||
Source6: os_check_timezone_for_rsyslog.sh
|
||||
Source7: timezone.cron
|
||||
|
||||
BuildRequires: gcc autoconf automake bison dos2unix flex pkgconfig python3-docutils libtool
|
||||
BuildRequires: libgcrypt-devel libuuid-devel zlib-devel krb5-devel libnet-devel gnutls-devel
|
||||
BuildRequires: libfastjson-devel >= 0.99.8 libestr-devel >= 0.1.9 systemd-devel >= 204-8
|
||||
BuildRequires: libdbi-devel mariadb-connector-c-devel net-snmp-devel qpid-proton-c-devel libcurl-devel
|
||||
Requires: logrotate >= 3.5.2 bash >= 2.0 libdbi mariadb-connector-c-devel
|
||||
%{?systemd_requires}
|
||||
|
||||
Provides: syslog
|
||||
Obsoletes: sysklogd < 1.5-11
|
||||
Provides: rsyslog-crypto rsyslog-doc rsyslog-elasticsearch rsyslog-mmjsonparse
|
||||
Provides: rsyslog-mmaudit rsyslog-mmsnmptrapd rsyslog-libdbi rsyslog-mysql
|
||||
Provides: rsyslog-snmp rsyslog-gssapi rsyslog-gnutls rsyslog-updspoof
|
||||
Obsoletes: rsyslog-crypto rsyslog-doc rsyslog-elasticsearch rsyslog-mmjsonparse
|
||||
Obsoletes: rsyslog-mmaudit rsyslog-mmsnmptrapd rsyslog-libdbi rsyslog-mysql
|
||||
Obsoletes: rsyslog-snmp rsyslog-gssapi rsyslog-gnutls rsyslog-updspoof
|
||||
|
||||
%description
|
||||
RSYSLOG is the rocket-fast system for log processing.It offers high-performance,
|
||||
great security features and a modular design. While it started as a regular syslogd,
|
||||
rsyslog has evolved into a kind of swiss army knife of logging, being able to
|
||||
accept inputs from a wide variety of sources, transform them, and output to the
|
||||
results to diverse destinations.
|
||||
|
||||
RSYSLOG can deliver over one million messages per second to local destinations when
|
||||
limited processing is applied. Even with remote destinations and more elaborate
|
||||
processing the performance is usually considered “stunning”.
|
||||
|
||||
%package hiredis
|
||||
Summary: Redis support for rsyslog
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: hiredis-devel
|
||||
|
||||
%description hiredis
|
||||
This package provides support from redis.
|
||||
|
||||
%package kafka
|
||||
Summary: Provides the omkafka module
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: librdkafka-devel
|
||||
|
||||
%description kafka
|
||||
This package provides support from kafka.
|
||||
|
||||
%package mmnormalize
|
||||
Summary: Log normalization support for rsyslog
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: libestr-devel liblognorm-devel >= 1.0.2
|
||||
|
||||
%description mmnormalize
|
||||
This module provides the capability to normalize log messages via liblognorm.
|
||||
|
||||
%package mmkubernetes
|
||||
Summary: Provides the mmkubernetes module
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: libcurl-devel
|
||||
|
||||
%description mmkubernetes
|
||||
This package provides support for kubernetes to add container metadata.
|
||||
|
||||
%package mongodb
|
||||
Summary: MongoDB support for rsyslog
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: mongo-c-driver-devel snappy-devel cyrus-sasl-devel
|
||||
|
||||
%description mongodb
|
||||
This package provides support from mongodb.
|
||||
|
||||
%package omamqp1
|
||||
Summary: Provides the omamqp1 module
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: qpid-proton-c-devel
|
||||
|
||||
%description omamqp1
|
||||
The omamqp1 output module can be used to send log messages via an AMQP
|
||||
1.0-compatible messaging bus.
|
||||
|
||||
%package pgsql
|
||||
Summary: PostgresSQL support for rsyslog
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: postgresql-devel
|
||||
|
||||
%description pgsql
|
||||
The rsyslog-pgsql package contains a dynamic shared object that will add
|
||||
PostgreSQL database support to rsyslog.
|
||||
|
||||
%package rabbitmq
|
||||
Summary: RabbitMQ support for rsyslog
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: librabbitmq-devel >= 0.2
|
||||
|
||||
%description rabbitmq
|
||||
This package provides support from rabbitmq.
|
||||
|
||||
%package relp
|
||||
Summary: RELP protocol support for rsyslog
|
||||
Group: System Environment/Daemons
|
||||
Requires: %name = %version-%release
|
||||
BuildRequires: librelp-devel >= 1.0.3
|
||||
|
||||
%description relp
|
||||
The rsyslog-relp package contains the rsyslog plugins that provide
|
||||
the ability to receive syslog messages via the reliable RELP
|
||||
protocol.
|
||||
|
||||
%package_help
|
||||
|
||||
%prep
|
||||
%setup -q -a 1 -T -c
|
||||
rm -r LICENSE README.md source build/objects.inv
|
||||
mv build doc
|
||||
|
||||
%autosetup -n %{name}-%{version} -D
|
||||
|
||||
%build
|
||||
autoreconf -vfi
|
||||
|
||||
%ifarch sparc64
|
||||
export CFLAGS="$RPM_OPT_FLAGS -fPIE -DPATH_PIDFILE=\\\"%{Pidfile}\\\""
|
||||
%else
|
||||
export CFLAGS="$RPM_OPT_FLAGS -fpie -DPATH_PIDFILE=\\\"%{Pidfile}\\\""
|
||||
export LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now"
|
||||
%endif
|
||||
|
||||
# the hiredis-devel package doesn't provide a pkg-config file
|
||||
export HIREDIS_CFLAGS=-I/usr/include/hiredis
|
||||
export HIREDIS_LIBS="-L%{_libdir} -lhiredis"
|
||||
%configure \
|
||||
--prefix=/usr \
|
||||
--disable-static \
|
||||
--disable-testbench \
|
||||
--enable-elasticsearch \
|
||||
--enable-generate-man-pages \
|
||||
--enable-gnutls \
|
||||
--enable-gssapi-krb5 \
|
||||
--enable-imdiag \
|
||||
--enable-imfile \
|
||||
--enable-imjournal \
|
||||
--enable-impstats \
|
||||
--enable-imptcp \
|
||||
--enable-libdbi \
|
||||
--enable-mail \
|
||||
--enable-mmanon \
|
||||
--enable-mmaudit \
|
||||
--enable-mmcount \
|
||||
--enable-mmkubernetes \
|
||||
--enable-mmjsonparse \
|
||||
--enable-mmnormalize \
|
||||
--enable-mmsnmptrapd \
|
||||
--enable-mysql \
|
||||
--enable-omamqp1 \
|
||||
--enable-omhiredis \
|
||||
--enable-omjournal \
|
||||
--enable-ommongodb \
|
||||
--enable-omprog \
|
||||
--enable-omrabbitmq \
|
||||
--enable-omstdout \
|
||||
--enable-omudpspoof \
|
||||
--enable-omuxsock \
|
||||
--enable-pgsql \
|
||||
--enable-pmaixforwardedfrom \
|
||||
--enable-pmcisconames \
|
||||
--enable-pmlastmsg \
|
||||
--enable-pmsnare \
|
||||
--enable-relp \
|
||||
--enable-snmp \
|
||||
--enable-unlimited-select \
|
||||
--enable-usertools \
|
||||
--enable-omkafka
|
||||
|
||||
%make_build
|
||||
|
||||
%check
|
||||
make V=1 check
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/rsyslog.d
|
||||
install -d -m 700 $RPM_BUILD_ROOT%{rsyslog_statedir}
|
||||
install -d -m 700 $RPM_BUILD_ROOT%{rsyslog_pkidir}
|
||||
install -d -m 755 $RPM_BUILD_ROOT%{rsyslog_docdir}/html
|
||||
|
||||
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/rsyslog.conf
|
||||
install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/rsyslog
|
||||
install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/rsyslog
|
||||
install -p -m 644 plugins/ommysql/createDB.sql $RPM_BUILD_ROOT%{rsyslog_docdir}/mysql-createDB.sql
|
||||
install -p -m 644 plugins/ompgsql/createDB.sql $RPM_BUILD_ROOT%{rsyslog_docdir}/pgsql-createDB.sql
|
||||
dos2unix tools/recover_qi.pl
|
||||
install -p -m 644 tools/recover_qi.pl $RPM_BUILD_ROOT%{rsyslog_docdir}/recover_qi.pl
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/cron.d/
|
||||
install -m 0600 %{_sourcedir}/timezone.cron $RPM_BUILD_ROOT/etc/cron.d/
|
||||
install -m 0500 %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}/os_rotate_and_save_log.sh
|
||||
install -m 0500 %{SOURCE6} $RPM_BUILD_ROOT%{_bindir}/os_check_timezone_for_rsyslog.sh
|
||||
|
||||
cp -r doc/* $RPM_BUILD_ROOT%{rsyslog_docdir}/html
|
||||
|
||||
%delete_la
|
||||
|
||||
sed -i '/^Alias/s/^/;/;/^Requires=syslog.socket/s/^/;/' $RPM_BUILD_ROOT%{_unitdir}/rsyslog.service
|
||||
|
||||
%pre
|
||||
|
||||
%post
|
||||
for n in /var/log/{messages,secure,maillog,spooler}
|
||||
do
|
||||
[ -f $n ] && continue
|
||||
umask 066 && touch $n
|
||||
done
|
||||
%systemd_post rsyslog.service
|
||||
|
||||
%preun
|
||||
%systemd_preun rsyslog.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart rsyslog.service
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS ChangeLog README.md
|
||||
%doc %{rsyslog_docdir}/html
|
||||
%doc %{rsyslog_docdir}/mysql-createDB.sql
|
||||
%doc %{rsyslog_docdir}/pgsql-createDB.sql
|
||||
%license COPYING*
|
||||
%{rsyslog_docdir}
|
||||
%dir %{_libdir}/rsyslog
|
||||
%dir %{_sysconfdir}/rsyslog.d
|
||||
%dir %{rsyslog_statedir}
|
||||
%dir %{rsyslog_pkidir}
|
||||
%{_sbindir}/rsyslogd
|
||||
%attr(500,root,root) %{_bindir}/os_rotate_and_save_log.sh
|
||||
%attr(500,root,root) %{_bindir}/os_check_timezone_for_rsyslog.sh
|
||||
/etc/cron.d/timezone.cron
|
||||
%{_unitdir}/rsyslog.service
|
||||
%config(noreplace) %{_sysconfdir}/rsyslog.conf
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/rsyslog
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/rsyslog
|
||||
%{_bindir}/rscryutil
|
||||
%{_libdir}/rsyslog/fmhttp.so
|
||||
%{_libdir}/rsyslog/fmhash.so
|
||||
%{_libdir}/rsyslog/imfile.so
|
||||
%{_libdir}/rsyslog/imgssapi.so
|
||||
%{_libdir}/rsyslog/imjournal.so
|
||||
%{_libdir}/rsyslog/imklog.so
|
||||
%{_libdir}/rsyslog/immark.so
|
||||
%{_libdir}/rsyslog/impstats.so
|
||||
%{_libdir}/rsyslog/imptcp.so
|
||||
%{_libdir}/rsyslog/imtcp.so
|
||||
%{_libdir}/rsyslog/imudp.so
|
||||
%{_libdir}/rsyslog/imuxsock.so
|
||||
%{_libdir}/rsyslog/lmcry_gcry.so
|
||||
%{_libdir}/rsyslog/lmgssutil.so
|
||||
%{_libdir}/rsyslog/lmnet.so
|
||||
%{_libdir}/rsyslog/lmnetstrms.so
|
||||
%{_libdir}/rsyslog/lmnsd_gtls.so
|
||||
%{_libdir}/rsyslog/lmnsd_ptcp.so
|
||||
%{_libdir}/rsyslog/lmregexp.so
|
||||
%{_libdir}/rsyslog/lmtcpclt.so
|
||||
%{_libdir}/rsyslog/lmtcpsrv.so
|
||||
%{_libdir}/rsyslog/lmzlibw.so
|
||||
%{_libdir}/rsyslog/mmanon.so
|
||||
%{_libdir}/rsyslog/mmaudit.so
|
||||
%{_libdir}/rsyslog/mmcount.so
|
||||
%{_libdir}/rsyslog/mmexternal.so
|
||||
%{_libdir}/rsyslog/mmjsonparse.so
|
||||
%{_libdir}/rsyslog/mmsnmptrapd.so
|
||||
%{_libdir}/rsyslog/ommail.so
|
||||
%{_libdir}/rsyslog/omelasticsearch.so
|
||||
%{_libdir}/rsyslog/omgssapi.so
|
||||
%{_libdir}/rsyslog/omlibdbi.so
|
||||
%{_libdir}/rsyslog/omjournal.so
|
||||
%{_libdir}/rsyslog/omudpspoof.so
|
||||
%{_libdir}/rsyslog/omprog.so
|
||||
%{_libdir}/rsyslog/omsnmp.so
|
||||
%{_libdir}/rsyslog/omstdout.so
|
||||
%{_libdir}/rsyslog/omtesting.so
|
||||
%{_libdir}/rsyslog/omuxsock.so
|
||||
%{_libdir}/rsyslog/ommysql.so
|
||||
%{_libdir}/rsyslog/pmaixforwardedfrom.so
|
||||
%{_libdir}/rsyslog/pmcisconames.so
|
||||
%{_libdir}/rsyslog/pmlastmsg.so
|
||||
%{_libdir}/rsyslog/pmsnare.so
|
||||
%exclude %{rsyslog_docdir}/html
|
||||
%exclude %{rsyslog_docdir}/mysql-createDB.sql
|
||||
%exclude %{rsyslog_docdir}/pgsql-createDB.sql
|
||||
%exclude %{_libdir}/rsyslog/imdiag.so
|
||||
|
||||
%files hiredis
|
||||
%{_libdir}/rsyslog/omhiredis.so
|
||||
|
||||
%files kafka
|
||||
%{_libdir}/rsyslog/omkafka.so
|
||||
|
||||
%files mmnormalize
|
||||
%{_libdir}/rsyslog/mmnormalize.so
|
||||
|
||||
%files mmkubernetes
|
||||
%{_libdir}/rsyslog/mmkubernetes.so
|
||||
|
||||
%files mongodb
|
||||
%{_bindir}/logctl
|
||||
%{_libdir}/rsyslog/ommongodb.so
|
||||
|
||||
%files omamqp1
|
||||
%{_libdir}/rsyslog/omamqp1.so
|
||||
|
||||
%files pgsql
|
||||
%doc %{rsyslog_docdir}/pgsql-createDB.sql
|
||||
%{_libdir}/rsyslog/ompgsql.so
|
||||
|
||||
%files rabbitmq
|
||||
%{_libdir}/rsyslog/omrabbitmq.so
|
||||
|
||||
%files relp
|
||||
%{_libdir}/rsyslog/imrelp.so
|
||||
%{_libdir}/rsyslog/omrelp.so
|
||||
|
||||
%files help
|
||||
%{_mandir}/man5/rsyslog.conf.5.gz
|
||||
%{_mandir}/man8/rsyslogd.8.gz
|
||||
%{_mandir}/man1/rscryutil.1.gz
|
||||
|
||||
%changelog
|
||||
* Tue Sep 10 2019 openEuler Buildteam <buildteam@openeuler.org> - version-release
|
||||
- Package init
|
||||
5
rsyslog.sysconfig
Normal file
5
rsyslog.sysconfig
Normal file
@ -0,0 +1,5 @@
|
||||
# Options for rsyslogd
|
||||
# Syslogd options are deprecated since rsyslog v3.
|
||||
# If you want to use them, switch to compatibility mode 2 by "-c 2"
|
||||
# See rsyslogd(8) for more details
|
||||
SYSLOGD_OPTIONS=""
|
||||
1
timezone.cron
Normal file
1
timezone.cron
Normal file
@ -0,0 +1 @@
|
||||
-*/15 * * * * root /bin/bash /usr/bin/os_check_timezone_for_rsyslog.sh 1>/dev/null 2>&1
|
||||
@ -0,0 +1,44 @@
|
||||
From 1b1efc640a57a757d1c7c64fd60d2187e3940060 Mon Sep 17 00:00:00 2001
|
||||
From: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
Date: Sat, 26 Jan 2019 15:27:29 +0000
|
||||
Subject: [PATCH] rsyslog-8.24.0, set permission of syslogd dot pid to 0644
|
||||
|
||||
reason: rsyslog-8.24.0, set permission of syslogd dot pid to 0644
|
||||
|
||||
Signed-off-by: guoxiaoqi <guoxiaoqi2@huawei.com>
|
||||
---
|
||||
tools/rsyslogd.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c
|
||||
index ccc114b..1f1328e 100644
|
||||
--- a/tools/rsyslogd.c
|
||||
+++ b/tools/rsyslogd.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
+#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#ifdef ENABLE_LIBLOGGING_STDLOG
|
||||
# include <liblogging/stdlog.h>
|
||||
@@ -265,6 +266,7 @@ static rsRetVal
|
||||
writePidFile(void)
|
||||
{
|
||||
FILE *fp;
|
||||
+ int fd;
|
||||
DEFiRet;
|
||||
|
||||
const char *tmpPidFile;
|
||||
@@ -278,7 +280,8 @@ writePidFile(void)
|
||||
if(tmpPidFile == NULL)
|
||||
tmpPidFile = PidFile;
|
||||
DBGPRINTF("rsyslogd: writing pidfile '%s'.\n", tmpPidFile);
|
||||
- if((fp = fopen((char*) tmpPidFile, "w")) == NULL) {
|
||||
+ if ( ((fd = open(tmpPidFile, O_WRONLY|O_CREAT|O_CLOEXEC, 0644)) == -1)
|
||||
+ || ((fp = fdopen(fd, "w")) == NULL) ) {
|
||||
perror("rsyslogd: error writing pid file (creation stage)\n");
|
||||
ABORT_FINALIZE(RS_RET_ERR);
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
Loading…
x
Reference in New Issue
Block a user