logrotate

Cenos Docker 安装

好久不见. 提交于 2019-12-06 14:42:00
https://www.runoob.com/docker/centos-docker-install.html 卸载旧版本 较旧的 Docker 版本称为 docker 或 docker-engine 。如果已安装这些程序,请卸载它们以及相关的依赖项。 $ sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine 安装 Docker Engine-Community 使用 Docker 仓库进行安装 在新主机上首次安装 Docker Engine-Community 之前,需要设置 Docker 仓库。之后,您可以从仓库安装和更新 Docker。 设置仓库 安装所需的软件包。yum-utils 提供了 yum-config-manager ,并且 device mapper 存储驱动程序需要 device-mapper-persistent-data 和 lvm2。 $ sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2

10.34 linux系统日志 10.35 screen工具

一个人想着一个人 提交于 2019-12-06 13:42:39
liunx系统日志 内容: • /var/log/messages • /etc/logrotate.conf 日志切割配置文件 参考 https://my.oschina.net/u/2000675/blog/908189 • dmesg命令 • /var/log/dmesg 日志 • last命令,调用的文件/var/log/wtmp • lastb命令查看登录失败的用户,对应的文件时/var/log/btmp • /var/log/secure /var/log/messages 系统的总日志syslog; 是做故障诊断是首要查看的日志文件,系统有一个轮回机制,每一个星期切换一个日志,切换后的日志名字类似于messages-20170930,会存放在/var/log/目录下面 那系统为什么有这个切割机制呢,是因为linux系统里面有个服务 logrotate ;防止系统日志无限制增大。 实战: /etc/logrotate.conf 日志切割配置文件 [root@linux-128 ~]# cat /etc/logrotate.conf # see "man logrotate" for details # rotate log files weekly weekly \\每周切割一次 # keep 4 weeks worth of backlogs rotate 4 \

Log rotation in Spring Boot service

送分小仙女□ 提交于 2019-12-06 11:14:17
问题 I am deploying a Spring Boot 2.0.0-RC1 application as an init.d service, but I can't figure out how to configure the log rotation. The app logs to /var/log/appname.log, but if I configure logrotate the logging stops after a rotation, because a new file is created, and the stdout/stderr redirection defined in the embedded script does not work anymore. If I configure the log rotation in my logging system there are two problems: I can't create the files in /var/log, and I still have the

day37:rsync工具及常用选项

时间秒杀一切 提交于 2019-12-05 18:35:26
1、rsync : remove sync(远程同步) ,数据备份工具,可以实现本地同步和远程同步,同步时可以 增量同步 ,只同步不相同的数据,也就是说只同步两个文件不不同的部分,因此速度非常快: rsync的五种命令格式 :注:src表示源文件 dest表示目标文件: rsync options src dest # 本地到本地 rsync options src user@ip地址:/目录 # 从本地到远程 rsync options user@ip地址:/目录 dest # 从远程主机到本地 rsync options src user@ip地址::dest # 从本地到远端主机(两个冒号,验证方式不同) rsync options user@ip地址::src dest # 从远端主机到本地(两个冒号,验证方式不同) 注释 :@前面的user可以省略,省略后则是以目标主机的当前用户验证,也可以写成普通用户: rsync -av src xiaoxiao@IP地址:/目录 options : -a:表示以递归方式传输文件,包含了-rlptgoD选项: -a--no-p -r:同步目录时需要加此选项,类似于cp的-r选项: -v:verbose,传输时可视化: -l:保留软连接,(因为没同步软连接的源文件,所以保留后也无法使用): -L:同步软连接时

linux 服务管理 Crontba、Ntpdate、Logrotate、Supervisor

好久不见. 提交于 2019-12-05 07:47:02
crond linux 系统则是由 cron (crond) 这个系统服务来控制的。Linux 系统上面原本就有非常多的计划性工作,因此这个系统服务是默认启动的。 另外, 由于使用者自己也可以设置计划任务,所以, Linux 系统也提供了使用者控制计划任务的命令 :crontab 命令。 https://www.cnblogs.com/intval/p/5763929.html ntpdate Linux服务器运行久时,系统时间就会存在一定的误差,一般情况下可以使用date命令进行时间设置,但在做数据库集群分片等操作时对多台机器的时间差是有要求的,此时就需要使用ntpdate进行时间同步 https://www.cnblogs.com/luchuangao/p/7795293.html https://www.cnblogs.com/zhi-leaf/p/6281549.html logrotate 用于对系统日志进行轮转、压缩和删除,也可以将日志发送到指定邮箱。使用logrotate指令,可让你轻松管理系统所产生的记录文件。每个记录文件都可被设置成每日,每周或每月处理,也能在文件太大时立即处理。您必须自行编辑,指定配置文件,预设的配置文件存放在 /etc/logrotate.conf 文件中. https://www.cnblogs.com/kevingrace/p

Apache rotate Access and Error logs Windows

六眼飞鱼酱① 提交于 2019-12-04 19:07:47
问题 How can I rotate the Apache Access and Error logs on a Window 2000 box? I include my batch file below as an answer. Is there a way of doing this directly via the Apache config file? I'm currently using the following customlog command to generate daily logs. CustomLog '|" "*Apache-Path/bin/rotatelogs.exe" "*Apache-Path/logs/backup/internet_access_%d-%m-%y.log" 86400' combined 回答1: Here's the DOS batch file, modified as annotated. I run it weekly and it keeps 8 weeks of zipped backups. You'll

logrotate cron job not rotating certain logs

廉价感情. 提交于 2019-12-04 09:11:23
问题 I added two scripts in "logrotate.d" directory for my application logs to be rotated. This is the config for one of them: <myLogFilePath> { compress copytruncate delaycompress dateext missingok notifempty daily rotate 30 } There is a "logrotate" script in "cron.daily" directory (which seems to be running daily as per cron logs): #!/bin/sh echo "logrotate_test" >>/tmp/logrotate_test #/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1 /usr/sbin/logrotate -v /etc/logrotate.conf &>>/root

How do I create a logrotate friendly file writer in Java or other platform?

戏子无情 提交于 2019-12-03 17:15:38
问题 What are the best practices for implementing a file writer/logger in Java that is compatible with logrotate? The goal would be allow logrotate to be used for all log management, instead of using built-in rotation/management of a logging API (Log4J, etc). I'd be interested in hearing comments/answers for other development platforms, aside from Java. 回答1: You simply need to periodically close and re-open the log file inside your application. You need a handler that keeps last close time. The

Forever log and logrotate

被刻印的时光 ゝ 提交于 2019-12-03 11:47:06
问题 I use forever to launch my nodeJs server and I choose the log file : forever -l /home/api/log/api_output.log start server.js I use logrotate to move logfile every day (like advise here : NodeJS/Forever archive logs), after one day my directory is like this : -rw-r--r-- 1 root root 0 avril 18 12:00 api_output.log -rw-r--r-- 1 root root 95492 avril 18 12:01 api_output.log-20140418 So, rotation is working, but the logs messages are now written in api_output.log-20140418, instead of api_output

Logrotate to clean up date stamped files

眉间皱痕 提交于 2019-12-03 08:24:36
问题 I'm currently trying to work out a method of tidying up Oracle Recover log files that are created by Cron... Currently, our Oracle standby recover process is invoked by Cron every 15mins using the following command: 0,15,30,45 * * * * /data/tier2/scripts/recover_standby.sh SID >> /data/tier2/scripts/logs/recover_standby_SID_`date +\%d\%m\%y`.log 2>&1 This creates files that look like: $ ls -l /data/tier2/scripts/logs/ total 0 -rw-r--r-- 1 oracle oinstall 0 Feb 1 23:45 recover_standby_SID