暂无图片
分享
刘浩
2020-03-30
Oracle Solaris 10修改系统日志保留时间
暂无图片 5M

公司安全检查期间,查出数据库服务器的系统日志保留日志不足180天,需要调整保留时间,请问大神,以下两份系统日志能调整保留时间吗?在哪里可以调整?在网上查了一天的资料没查到相关信息,特来墨天轮求助!!!
/dev/sysmsg
/var/adm/messages
image.png

目前只有一个月的messages日志
image.png

收藏
分享
3条回答
默认
最新
lscomeon

logadm -C 4 -c -s 300m -w /var/adm/wtmpx

//    -C count     Delete the oldest versions until there are not more than count files left.
//    -p period    Rotate a  log  file  after  the  specified  time  period  (period) .
//    -c           Rotate the log file by copying it and truncating the original  logfile to zero length, rather than renaming the file.
//    -w entryname Write an entry into the config file (that is, /etc/logadm.conf)
//    -s size      Rotate the log file only if its size is greater than or equal to size.
//    -z count     Compress old log files after all other commands have been executed.

tail -1 /etc/logadm.conf

wtmpx -C 4 -c -s 300m /var/adm/wtmpx

logadm -v

–lines omitted–

processing logname: /var/adm/wtmpx

#     using default template: file.file.n
mkdir -p /var/adm # verify directory exists

cp -fp /var/adm/wtmpx /var/adm/wtmpx.0 # rotate log file via copy (-c flag)

cp -f /dev/null /var/adm/wtmpx # trucate log file (-c flag)

touch /var/adm/wtmpx
chown 4:4 /var/adm/wtmpx
chmod 644 /var/adm/wtmpx
#     recording rotation date Tue Feb 25 13:51:14 2014 for /var/adm/wtmpx

writing changes to /var/logadm.conf

ls -l /var/adm/wtmpx*

-rw-r–r--   1 adm      adm            0 Feb 25 13:51 /var/adm/wtmpx
-rw-r–r--   1 adm      adm    362328000 Feb 25 12:54 /var/adm/wtmpx.0

暂无图片 评论
暂无图片 有用 0
lscomeon

solaris 使用logadm配置日志分割及切换保留策略,前几天刚配置的命令是
logadm -C 12 -c -p 1m -w /var/adm/wtmpx
按照我的理解是1个月切换1次,保留12份,也请大家审核一下,我这正在做测试验证

暂无图片 评论
暂无图片 有用 0
刘浩
问题已关闭: 问题已经得到解决
暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏