当前位置:论坛首页 > Linux面板 > 建议

【优质分享】ols日志切割,解决办法

发表在 Linux面板2021-12-30 09:56 [复制链接] 2 2633

  1.     ols_access_log = os.path.join(logsPath,siteName + '_ols.access_log')
  2.     ols_error_log =  os.path.join(logsPath,siteName + '_ols.error_log')
  3.     if os.path.exists(ols_access_log):
  4.         history_log_file = log_path + '/' + siteName +'_access_'+his_date+'.log'
  5.         shutil.move(ols_access_log,history_log_file)
  6.         if is_gzip:
  7.             os.system('gzip {}'.format(history_log_file))
  8.             print('|---已切割日志到:'+history_log_file+'.gz')
  9.         else:
  10.             print('|---已切割日志到:'+history_log_file+'.gz')
  11.     if os.path.exists(ols_error_log):
  12.         history_log_file = log_path + '/' + siteName +'_error_'+his_date+'.log'
  13.         shutil.move(ols_error_log,history_log_file)
  14.         if is_gzip:
  15.             os.system('gzip {}'.format(history_log_file))
  16.             print('|---已切割日志到:'+history_log_file+'.gz')
  17.         else:
  18.             print('|---已切割日志到:'+history_log_file+'.gz')
复制代码
在/www/server/panel/script/logsBackup 加入以上代码即可。。。
使用道具 举报 只看该作者 回复
发表于 2021-12-30 10:03:46 | 显示全部楼层
如有ols日志不记录或者记录不全等问题,请尝试修复面板后再看,或者使用国际版安装ols环境。。。
目前是ols日志问题的一些解决方案,请各位参考,同时也请官方能够更新采纳此问题。。。
使用道具 举报 回复 支持 反对
发表于 2021-12-30 10:15:36 | 显示全部楼层
whhack 发表于 2021-12-30 10:03
如有ols日志不记录或者记录不全等问题,请尝试修复面板后再看,或者使用国际版安装ols环境。。。
目前是ols ...

感谢您的分享
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表