logmngr: remote uci option file_path

* this is a bit of an overkill and not needed. Instead, we can use
option file to have full path to file including file name.

example: /var/log/messages

* other formatting errors and remove unused function in syslog-ng
This commit is contained in:
Rahul Thakur 2024-07-18 12:46:18 +05:30
parent 3e14637e3d
commit 10f3015d32
2 changed files with 24 additions and 44 deletions

View file

@ -174,22 +174,16 @@ handle_log_file() {
return
fi
local file_name
local file_path
config_get file_name $section file_name
if [ -z "$file_name" ]; then
local file
config_get file $section file
if [ -z "$file" ]; then
return
fi
echo "[OUTPUT]" >> ${TMP_CONF_FILE}
echo " name file" >> ${TMP_CONF_FILE}
echo " match $match" >> ${TMP_CONF_FILE}
echo " file $file_name" >> ${TMP_CONF_FILE}
config_get file_path $section file_path
if [ -n "$file_path" ]; then
echo " path $file_path" >> ${TMP_CONF_FILE}
fi
echo " file $file" >> ${TMP_CONF_FILE}
}
handle_log_remote() {

View file

@ -164,15 +164,6 @@ handle_filter_conf() {
echo "};" >> ${TMP_CONF_FILE}
}
create_filter_section() {
local match="$1"
echo "[FILTER]" >> ${TMP_CONF_FILE}
echo " name grep" >> ${TMP_CONF_FILE}
echo " match $match" >> ${TMP_CONF_FILE}
echo " logical_op or" >> ${TMP_CONF_FILE} # handle multiple filters
}
handle_filter_ref() {
local filter_name="$1"
config_foreach handle_filter_conf filter "$filter_name"
@ -195,20 +186,15 @@ handle_log_file() {
return
fi
local file_name
local file_path
config_get file_name $section file_name
if [ -z "$file_name" ]; then
local file
config_get file $section file
if [ -z "$file" ]; then
return
fi
config_get file_path $section file_path
if [ -n "$file_path" ]; then
file_name=$file_path/$file_name
fi
echo -e "destination file_$match {" >> ${TMP_CONF_FILE}
echo -e "\t file("$file_name");" >> ${TMP_CONF_FILE}
echo -e "\tfile("$file");" >> ${TMP_CONF_FILE}
echo -e "};" >> ${TMP_CONF_FILE}
# now generate the log section for each action section to bring into effect