Ubuntu日志保存时间默认通常为7天。
这是因为Ubuntu系统使用logrotate工具管理日志,默认配置下,logrotate每天轮转一次日志文件,并保留最近7天的日志文件。但这个时间可以根据实际需求进行修改,通过编辑logrotate的配置文件,如/etc/logrotate.conf或/etc/logrotate.d/rsyslog等,可设置保留更长时间或按特定条件(如日志文件大小)进行轮转和清理。
/etc/logrotate.conf
/etc/logrotate.d/rsyslog