- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在我的 Ubuntu 服务器上为 apache 设置 logrotate,但是在尝试测试轮换时我不断收到以下错误:
logrotate_script: 4: logrotate_script: : not found
error: error running shared prerotate script for '/var/log/apache2/*.log '
我已经在调试、详细和强制模式下运行它,但我似乎看不到任何可以明确指出问题的地方,所以我非常感谢任何帮助。
这是我的/etc/logrotate.d/apache2
文件:
/var/log/apache2/*.log {
size 100k
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 restart > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}
这是运行命令 sudo logrotate -vf/etc/logrotate.d/apache2
的输出:
reading config file /etc/logrotate.d/apache2
Handling 1 logs
rotating pattern: /var/log/apache2/*.log forced from command line (14 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apache2/access.log
log does not need rotating
considering log /var/log/apache2/access_proxy.log
log needs rotating
considering log /var/log/apache2/error.log
log needs rotating
considering log /var/log/apache2/error_proxy.log
log does not need rotating
considering log /var/log/apache2/other_vhosts_access.log
log needs rotating
rotating log /var/log/apache2/access_proxy.log, log->rotateCount is 14
dateext suffix '-20190122'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/apache2/access_proxy.log.1 does not exist
renaming /var/log/apache2/access_proxy.log.14.gz to /var/log/apache2/access_proxy.log.15.gz (rotatecount 14, logstart 1, i 14),
old log /var/log/apache2/access_proxy.log.14.gz does not exist
renaming /var/log/apache2/access_proxy.log.13.gz to /var/log/apache2/access_proxy.log.14.gz (rotatecount 14, logstart 1, i 13),
old log /var/log/apache2/access_proxy.log.13.gz does not exist
renaming /var/log/apache2/access_proxy.log.12.gz to /var/log/apache2/access_proxy.log.13.gz (rotatecount 14, logstart 1, i 12),
old log /var/log/apache2/access_proxy.log.12.gz does not exist
renaming /var/log/apache2/access_proxy.log.11.gz to /var/log/apache2/access_proxy.log.12.gz (rotatecount 14, logstart 1, i 11),
old log /var/log/apache2/access_proxy.log.11.gz does not exist
renaming /var/log/apache2/access_proxy.log.10.gz to /var/log/apache2/access_proxy.log.11.gz (rotatecount 14, logstart 1, i 10),
old log /var/log/apache2/access_proxy.log.10.gz does not exist
renaming /var/log/apache2/access_proxy.log.9.gz to /var/log/apache2/access_proxy.log.10.gz (rotatecount 14, logstart 1, i 9),
old log /var/log/apache2/access_proxy.log.9.gz does not exist
renaming /var/log/apache2/access_proxy.log.8.gz to /var/log/apache2/access_proxy.log.9.gz (rotatecount 14, logstart 1, i 8),
old log /var/log/apache2/access_proxy.log.8.gz does not exist
renaming /var/log/apache2/access_proxy.log.7.gz to /var/log/apache2/access_proxy.log.8.gz (rotatecount 14, logstart 1, i 7),
old log /var/log/apache2/access_proxy.log.7.gz does not exist
renaming /var/log/apache2/access_proxy.log.6.gz to /var/log/apache2/access_proxy.log.7.gz (rotatecount 14, logstart 1, i 6),
old log /var/log/apache2/access_proxy.log.6.gz does not exist
renaming /var/log/apache2/access_proxy.log.5.gz to /var/log/apache2/access_proxy.log.6.gz (rotatecount 14, logstart 1, i 5),
old log /var/log/apache2/access_proxy.log.5.gz does not exist
renaming /var/log/apache2/access_proxy.log.4.gz to /var/log/apache2/access_proxy.log.5.gz (rotatecount 14, logstart 1, i 4),
old log /var/log/apache2/access_proxy.log.4.gz does not exist
renaming /var/log/apache2/access_proxy.log.3.gz to /var/log/apache2/access_proxy.log.4.gz (rotatecount 14, logstart 1, i 3),
old log /var/log/apache2/access_proxy.log.3.gz does not exist
renaming /var/log/apache2/access_proxy.log.2.gz to /var/log/apache2/access_proxy.log.3.gz (rotatecount 14, logstart 1, i 2),
old log /var/log/apache2/access_proxy.log.2.gz does not exist
renaming /var/log/apache2/access_proxy.log.1.gz to /var/log/apache2/access_proxy.log.2.gz (rotatecount 14, logstart 1, i 1),
old log /var/log/apache2/access_proxy.log.1.gz does not exist
renaming /var/log/apache2/access_proxy.log.0.gz to /var/log/apache2/access_proxy.log.1.gz (rotatecount 14, logstart 1, i 0),
old log /var/log/apache2/access_proxy.log.0.gz does not exist
log /var/log/apache2/access_proxy.log.15.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/apache2/error.log, log->rotateCount is 14
dateext suffix '-20190122'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/apache2/error.log.1 does not exist
renaming /var/log/apache2/error.log.14.gz to /var/log/apache2/error.log.15.gz (rotatecount 14, logstart 1, i 14),
old log /var/log/apache2/error.log.14.gz does not exist
renaming /var/log/apache2/error.log.13.gz to /var/log/apache2/error.log.14.gz (rotatecount 14, logstart 1, i 13),
old log /var/log/apache2/error.log.13.gz does not exist
renaming /var/log/apache2/error.log.12.gz to /var/log/apache2/error.log.13.gz (rotatecount 14, logstart 1, i 12),
old log /var/log/apache2/error.log.12.gz does not exist
renaming /var/log/apache2/error.log.11.gz to /var/log/apache2/error.log.12.gz (rotatecount 14, logstart 1, i 11),
old log /var/log/apache2/error.log.11.gz does not exist
renaming /var/log/apache2/error.log.10.gz to /var/log/apache2/error.log.11.gz (rotatecount 14, logstart 1, i 10),
old log /var/log/apache2/error.log.10.gz does not exist
renaming /var/log/apache2/error.log.9.gz to /var/log/apache2/error.log.10.gz (rotatecount 14, logstart 1, i 9),
old log /var/log/apache2/error.log.9.gz does not exist
renaming /var/log/apache2/error.log.8.gz to /var/log/apache2/error.log.9.gz (rotatecount 14, logstart 1, i 8),
old log /var/log/apache2/error.log.8.gz does not exist
renaming /var/log/apache2/error.log.7.gz to /var/log/apache2/error.log.8.gz (rotatecount 14, logstart 1, i 7),
old log /var/log/apache2/error.log.7.gz does not exist
renaming /var/log/apache2/error.log.6.gz to /var/log/apache2/error.log.7.gz (rotatecount 14, logstart 1, i 6),
old log /var/log/apache2/error.log.6.gz does not exist
renaming /var/log/apache2/error.log.5.gz to /var/log/apache2/error.log.6.gz (rotatecount 14, logstart 1, i 5),
old log /var/log/apache2/error.log.5.gz does not exist
renaming /var/log/apache2/error.log.4.gz to /var/log/apache2/error.log.5.gz (rotatecount 14, logstart 1, i 4),
old log /var/log/apache2/error.log.4.gz does not exist
renaming /var/log/apache2/error.log.3.gz to /var/log/apache2/error.log.4.gz (rotatecount 14, logstart 1, i 3),
old log /var/log/apache2/error.log.3.gz does not exist
renaming /var/log/apache2/error.log.2.gz to /var/log/apache2/error.log.3.gz (rotatecount 14, logstart 1, i 2),
old log /var/log/apache2/error.log.2.gz does not exist
renaming /var/log/apache2/error.log.1.gz to /var/log/apache2/error.log.2.gz (rotatecount 14, logstart 1, i 1),
old log /var/log/apache2/error.log.1.gz does not exist
renaming /var/log/apache2/error.log.0.gz to /var/log/apache2/error.log.1.gz (rotatecount 14, logstart 1, i 0),
old log /var/log/apache2/error.log.0.gz does not exist
log /var/log/apache2/error.log.15.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/apache2/other_vhosts_access.log, log->rotateCount is 14
dateext suffix '-20190122'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/apache2/other_vhosts_access.log.1 does not exist
renaming /var/log/apache2/other_vhosts_access.log.14.gz to /var/log/apache2/other_vhosts_access.log.15.gz (rotatecount 14, logstart 1, i 14),
old log /var/log/apache2/other_vhosts_access.log.14.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.13.gz to /var/log/apache2/other_vhosts_access.log.14.gz (rotatecount 14, logstart 1, i 13),
old log /var/log/apache2/other_vhosts_access.log.13.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.12.gz to /var/log/apache2/other_vhosts_access.log.13.gz (rotatecount 14, logstart 1, i 12),
old log /var/log/apache2/other_vhosts_access.log.12.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.11.gz to /var/log/apache2/other_vhosts_access.log.12.gz (rotatecount 14, logstart 1, i 11),
old log /var/log/apache2/other_vhosts_access.log.11.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.10.gz to /var/log/apache2/other_vhosts_access.log.11.gz (rotatecount 14, logstart 1, i 10),
old log /var/log/apache2/other_vhosts_access.log.10.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.9.gz to /var/log/apache2/other_vhosts_access.log.10.gz (rotatecount 14, logstart 1, i 9),
old log /var/log/apache2/other_vhosts_access.log.9.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.8.gz to /var/log/apache2/other_vhosts_access.log.9.gz (rotatecount 14, logstart 1, i 8),
old log /var/log/apache2/other_vhosts_access.log.8.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.7.gz to /var/log/apache2/other_vhosts_access.log.8.gz (rotatecount 14, logstart 1, i 7),
old log /var/log/apache2/other_vhosts_access.log.7.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.6.gz to /var/log/apache2/other_vhosts_access.log.7.gz (rotatecount 14, logstart 1, i 6),
old log /var/log/apache2/other_vhosts_access.log.6.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.5.gz to /var/log/apache2/other_vhosts_access.log.6.gz (rotatecount 14, logstart 1, i 5),
old log /var/log/apache2/other_vhosts_access.log.5.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.4.gz to /var/log/apache2/other_vhosts_access.log.5.gz (rotatecount 14, logstart 1, i 4),
old log /var/log/apache2/other_vhosts_access.log.4.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.3.gz to /var/log/apache2/other_vhosts_access.log.4.gz (rotatecount 14, logstart 1, i 3),
old log /var/log/apache2/other_vhosts_access.log.3.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.2.gz to /var/log/apache2/other_vhosts_access.log.3.gz (rotatecount 14, logstart 1, i 2),
old log /var/log/apache2/other_vhosts_access.log.2.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.1.gz to /var/log/apache2/other_vhosts_access.log.2.gz (rotatecount 14, logstart 1, i 1),
old log /var/log/apache2/other_vhosts_access.log.1.gz does not exist
renaming /var/log/apache2/other_vhosts_access.log.0.gz to /var/log/apache2/other_vhosts_access.log.1.gz (rotatecount 14, logstart 1, i 0),
old log /var/log/apache2/other_vhosts_access.log.0.gz does not exist
log /var/log/apache2/other_vhosts_access.log.15.gz doesn't exist -- won't try to dispose of it
running prerotate script
logrotate_script: 4: logrotate_script: : not found
error: error running shared prerotate script for '/var/log/apache2/*.log '
非常感谢任何帮助,谢谢:)
编辑:碰撞
最佳答案
这有点令人困惑,但是/etc/logrotate.d/httpd-prerotate 是您尝试执行的文件吗?每运行零件 man
run−parts [−−test] [−−verbose] [−−report] [−−lsbsysinit] [−−regex=RE] [−−umask=umask] [−−arg=argument] [−−exit−on−error] [−−help] [−−version] [−−list] [−−reverse] [−−] DIRECTORY
如果您将单个文件传递给 run-parts,它不会知道如何处理它。只需将该文件设置为可执行文件并直接调用它,即
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
/etc/logrotate.d/httpd-prerotate;
fi;
endscript
关于linux - Logrotate 不旋转或创建新文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54311989/
我正在为某些 Web 应用程序编写自己的 logrotate 配置: /home/me/public_html/logs/*.log { daily missingok rot
我查看了 logrotate.conf 示例以及/etc/logrotate.d 目录中的所有内容。我无法在这些文件中找到有关变量的文档。 我正在尝试创建一个配置文件来轮换我们正在编写的应用程序的日志
我查看了手册页,在这里搜索,用谷歌搜索等等。 有人知道 logrotate 使用的默认大小吗? 您可以引用什么引用来说明默认大小? 我知道我可以在我的配置文件中专门设置大小。 最佳答案 没有默认大小,
我查看了手册页,在这里搜索,用谷歌搜索等等。 有人知道 logrotate 使用的默认大小吗? 您可以引用什么引用来说明默认大小? 我知道我可以在我的配置文件中专门设置大小。 最佳答案 没有默认大小,
我正在使用 logrotate,我可以看到我通过包管理器安装的东西在这里安装了东西: /etc/logrotate.d/ 例如我有文件 nginx其中包含这个 /var/log/nginx/*.log
//, 这个问题有点模棱两可。 场景如下: 我有以下三个扩展名的日志,但我当前的规则仅适用于 *.log 文件: .1 .log .txt 另外,因为 Tomcat 正在轮换日志,所以我有以下内容:
因此,设置最大日志轮换大小似乎只有在 uwsgi.ini 而不是/etc/logrotate.d/uwsgi 中设置时才有效(即使使用/etc/logrotate.d/uwsgi 文件手动测试 log
我有一个自定义应用程序 (myApp),它正在将日志写入文件“/var/log/myApp”。我可以看到正在写入的日志并且它工作正常。现在我正在尝试为此文件设置 logrotate,为此我创建了一个配
CentOS v.7 Logrotate v.3.8.6 我将 logrotate 设置为在文件达到 5M 时旋转,但它会忽略它,如果我每天添加,无论大小如何,它都会每天旋转,我尝试使用 size、m
logrotate 没有旋转我的日志 要验证日志文件不为空: # ls -laFh /var/log/cisco-meraki.log -rw-r----- 1 root adm 2.8G Sep
我正在使用 logrotate管理我的日志。因为我必须管理一堆日志文件。我的 logrotate 配置看起来像 /log/typeA*.log /log/typeB*.log /log/typeC*.
我想使用 logrotate 来管理我的日志。我发现压缩选项非常有用。但是 gzip(默认压缩)对我的日志来说并不是最好的(实验上,其他压缩的效率可以提高两倍到五倍)。 是否可以更改压缩类型?我没有找
为什么 logrotate 会删除文件而不是旋转它? 这是配置: /var/log/httpd/*log { size 1G missingok notifempty
美好的一天! 我尝试使用 linux 的 logrotate 工具来轮换我的 tomcat 日志。我在/etc/logrotate.d下创建了一个名为tomcat的脚本 /path/to/tomcat
我正在尝试在 RHEL 中为 tomcat6 日志配置 logrotate。目前,logrotate 对 catalina.out 日志工作正常,它被正确地旋转和压缩。 问题在于其中包含日期的文件,例
我有一个每天运行一次的 logrotate 策略,因为它是 cron.daily 的一部分。我想在达到一定大小时触发文件的 logrotate。所以我正在寻找一种方法来使文件大小成为触发器,而不是每小
我有一组针对不同进程的特定日志。考虑 Log_name1.Date.0.log(当前日期最早的)-----> Log_name1.Date.1.log Log_name1.Date.2.log Log
我正在尝试在我的 Ubuntu 服务器上为 apache 设置 logrotate,但是在尝试测试轮换时我不断收到以下错误: logrotate_script: 4: logrotate_script
我有一个测试应用程序,它每小时运行一次,并在每次执行时使用唯一的日志文件。要清理日志,已设置以下 logrotate 配置: { # Daily rotation with 1 wee
我有一个 Rust 应用程序,它将日志重定向到某个目录。为了合并滚动策略,我正在使用 logrotate linux 实用程序。为此,我在/etc/logrotate.d 中创建了我的应用程序特定配置
我是一名优秀的程序员,十分优秀!