-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogsConf.sh
More file actions
74 lines (73 loc) · 2.54 KB
/
Copy pathLogsConf.sh
File metadata and controls
74 lines (73 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
if [ -f /etc/lsb-release ]; then
os=$(lsb_release -s -d)
elif [ -f /etc/redhat-release ]; then
os=`cat /etc/redhat-release`
else
os="$(uname -s) $(uname -r)"
fi
RED='\033[0;31m';
GR='\033[0;32m';
NC='\033[0m';
os=`echo $os | cut -f 1 -d " "`;
#echo $os;
echo -e "${GR} Running ... ${NC}"
case $os in
Ubuntu)
touch /etc/rsyslog.d/10-phpg.conf
true > /etc/rsyslog.d/10-phpg.conf
cat << EOT >> /etc/rsyslog.d/10-phpg.conf
#/etc/rsyslog.d/10-phpg.conf
local2.err /var/log/phpg/err.log
local2.debug /var/log/phpg/debug.log
local3.warn /var/log/phpg/warn.log
local3.debug /var/log/phpg/debug.log
local4.info /var/log/phpg/info.log
local4.debug /var/log/phpg/debug.log
EOT
mkdir /var/log/phpg
cd /var/log/phpg/
touch err.log info.log debug.log warn.log
#cd - 2&> /dev/null
chown -R www-data:adm /var/log/phpg
chown syslog:adm /var/log/phpg/*
echo -e "${GR} Testing ... ${NC}"
systemctl restart rsyslog.service
systemctl restart apache2
if [ -d /var/log/phpg ] && [ -f /etc/rsyslog.d/10-phpg.conf ] && [ -f /var/log/phpg/err.log ] && [ -f /var/log/phpg/debug.log ] && [ -f /var/log/phpg/warn.log ] && [ -f /var/log/phpg/info.log ] ; then
echo -e "Application logging system Configuration ${GR} Successfully ${NC} Done in ${GR} '$os'${NC} ";
echo -e "Regards ${GR} Logging Team ${NC} ";
else
echo -e "${RED} Failed ${NC} To Configure Application Logging System in ${RED} '$os'${NC} ";
echo -e "${RED} Contact Logging Team ${NC} ";
fi
;;
CentOS)
touch /etc/rsyslog.d/phpg.conf
true > /etc/rsyslog.d/phpg.conf
cat << EOT >> /etc/rsyslog.d/phpg.conf
#/etc/rsyslog.d/phpg.conf
local2.err /var/log/phpg/err.log
local2.debug /var/log/phpg/debug.log
local3.warn /var/log/phpg/warn.log
local3.debug /var/log/phpg/debug.log
local4.info /var/log/phpg/info.log
local4.debug /var/log/phpg/debug.log
EOT
mkdir /var/log/phpg
cd /var/log/phpg/
touch err.log info.log debug.log warn.log
#cd - 2&> /dev/null
chown -R apache:apache /var/log/phpg
echo -e "${GR} Testing ... ${NC}"
systemctl restart rsyslog.service
systemctl restart httpd.service
if [ -d /var/log/phpg ] && [ -f /etc/rsyslog.d/phpg.conf ] && [ -f /var/log/phpg/err.log ] && [ -f /var/log/phpg/debug.log ] && [ -f /var/log/phpg/warn.log ] && [ -f /var/log/phpg/info.log ] ; then
echo -e "Application logging system Configuration ${GR} Successfully ${NC} Done in ${GR} '$os'${NC} ";
echo -e "Regards ${GR} Logging Team ${NC} ";
else
echo -e "${RED} Failed ${NC} To Configure Application Logging System in ${RED} '$os'${NC} ";
echo -e "${RED} Contact Logging Team ${NC} ";
fi
;;
esac