Commit 199f16b8 by ChongmingDu

logrotate nginx/mongo logs.update readme

parent 2b29d98e
...@@ -6,6 +6,14 @@ ...@@ -6,6 +6,14 @@
## 面向群体:全体 ## 面向群体:全体
## 使用步骤
1. 确定自己的需求(是否需要ssl,是否准备好ssl证书,是否有测试和正式环境的域名,磁盘使用情况,应用使用情况等。出现如上问题自行解决)
2. 配置nginx,一定要把nginx/templates里面的几个nginx配置文件确认明白(使用到了ssl证书请放在file目录下),如果没有请按照已有几个自行配置(自行充分测试)
3. 配置filebeat。修改filebeat/templates/filebeat.yml
4. 配置zabbix。分别确定zabbix server和agent的机器,修改相应的配置(templates里面的配置文件)。
5. 修改host.yml.examples内容,样例相同位置的host文件
6. 根据每个相应模块的相应使用过程使用
## Base ## Base
裸配置机器请先运行此模块 裸配置机器请先运行此模块
......
[online] [online]
172.16.233.36 hostname=officialpc1 172.16.233.36 hostname=officialpc1 #hostname这里是想要配置的主机名
172.16.233.37 hostname=officialpc2 172.16.233.37 hostname=officialpc2
[test] [test]
172.16.233.38 hostname=officialpctest 172.16.233.38 hostname=officialpctest
\ No newline at end of file
#!/bin/bash #!/bin/bash
#Install packages #Install packages
yum install -y bash-completion.noarch bash-completion-extras.noarch wget vim asciidoc xmlto docbook2x curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker gd-devel java-1.8.0-openjdk java-1.8.0-openjdk-devel yum install -y bash-completion.noarch bash-completion-extras.noarch wget vim asciidoc xmlto docbook2x curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker gd-devel java-1.8.0-openjdk java-1.8.0-openjdk-devel lsof htop
yum groups install -y "System Administration Tools" "Development Tools" "System Management" yum groups install -y "System Administration Tools" "Development Tools" "System Management"
#set sysctl #set sysctl
......
/usr/local/mongodb/master.log {
weekly
rotate 4
compress
delaycompress
missingok
notifempty
create 0664 root root
}
\ No newline at end of file
/data/nginx/error.log {
monthly
rotate 2
compress
delaycompress
missingok
notifempty
create 0664 root root
postrotate
if [ -f /data/nginx/nginx.pid ]; then
kill -USR1 `cat /data/nginx/nginx.pid`
fi
endscript
}
\ No newline at end of file
/data/nginx/access.log {
weekly
rotate 4
compress
delaycompress
missingok
notifempty
create 0664 root root
postrotate
if [ -f /data/nginx/nginx.pid ]; then
kill -USR1 `cat /data/nginx/nginx.pid`
fi
endscript
}
\ No newline at end of file
...@@ -7,6 +7,21 @@ ...@@ -7,6 +7,21 @@
- name: "Initialization OS" - name: "Initialization OS"
shell: /bin/bash /tmp/init.sh shell: /bin/bash /tmp/init.sh
- name: "add logrotate file mongo"
copy:
src: mongo
dest: /etc/logrotate.d/
- name: "add logrotate file nginx-access"
copy:
src: nginx-access
dest: /etc/logrotate.d/
- name: "add logrotate file nginx-err"
copy:
src: nginx-err
dest: /etc/logrotate.d/
- name: "Add to tomcat user" - name: "Add to tomcat user"
user: user:
name: tomcat name: tomcat
......
...@@ -9,7 +9,7 @@ pid /data/nginx/nginx.pid; ...@@ -9,7 +9,7 @@ pid /data/nginx/nginx.pid;
events { events {
worker_connections 1024; worker_connections 65535;
} }
http { http {
...@@ -21,7 +21,6 @@ http { ...@@ -21,7 +21,6 @@ http {
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
access_log /data/nginx/access.log main; access_log /data/nginx/access.log main;
access_log "pipe:rollback logs/access_log interval=1d baknum=7 maxsize=2G" main;
client_header_timeout 10m; client_header_timeout 10m;
client_body_timeout 10m; client_body_timeout 10m;
......
############ GENERAL PARAMETERS ################# ############ GENERAL PARAMETERS #################
PidFile=/data/var/run/zabbix/zabbix_agentd.pid PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/data/var/log/zabbix/zabbix_agentd.log LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0 LogFileSize=0
......
--- ---
# - name: "Install zabbix_server " - name: "Install zabbix_server "
# hosts: zabbix_server hosts: zabbix_server
# remote_user: root
# vars_files:
# - var/main.yml
# roles:
# - zabbix_server
- name: "Install zabbix_agent "
hosts: zabbix_agent
remote_user: root remote_user: root
vars_files: vars_files:
- var/main.yml - var/main.yml
roles: roles:
- zabbix_agent - zabbix_server
\ No newline at end of file
# - name: "Install zabbix_agent "
# hosts: zabbix_agent
# remote_user: root
# vars_files:
# - var/main.yml
# roles:
# - zabbix_agent
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment