Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

障害などで意図せずログが滞留した場合にログが削除できなくなる事象 #142

Closed
takuma0121 opened this issue Sep 22, 2023 · 1 comment · Fixed by #143
Assignees
Labels
bug Something isn't working
Milestone

Comments

@takuma0121
Copy link
Contributor

事象

root@sensor:/usr/local/zeek/logs/2023-09-22# rm $(find /usr/local/zeek/logs -name "*.log")
bash: /bin/rm: Argument list too long

対処方法(要検証)→該当のコード

find /usr/local/zeek/logs -name "*.log" -print0 | xargs -0 rm
@takuma0121 takuma0121 added the bug Something isn't working label Sep 22, 2023
@takuma0121 takuma0121 added this to the to be decided milestone Sep 22, 2023
@helenwangjia
Copy link
Contributor

helenwangjia commented Oct 25, 2023

Argument list too longは通常、処理するファイルの数が多すぎるため、パラメータリストの長さがOSの制限を超えたためです。

OsecT20での検証:

  1. rm $(find /usr/local/zeek/logs -name "*.log")をコメントアウトしました。
  2. root@sensor:/usr/local/zeek/logs/2023-10-25# ls
bacnet.06:43:01-06:44:00.log              cclink-ie-tsn-slmp.06:47:00-06:48:00.log  notice.06:47:00-06:48:00.log
bacnet.06:45:00-06:46:00.log              cclink-ie-tsn-slmp.06:52:00-06:53:00.log  notice.06:48:00-06:49:00.log
bacnet.06:46:00-06:47:00.log              cclink-ie-tsn.06:42:00-06:43:00.log       notice.06:53:00-06:54:00.log
bacnet.06:47:00-06:48:00.log              cclink-ie-tsn.06:45:00-06:46:00.log       stats.06:15:00-06:16:00.log
bacnet.06:52:00-06:53:00.log              cclink-ie-tsn.06:46:00-06:47:00.log       stats.06:16:00-06:17:00.log
bacnet.06:53:00-06:54:00.log              cclink-ie-tsn.06:53:00-06:54:00.log       stats.06:20:00-06:21:00.log
broker.06:41:00-06:42:00.log              cclink-ie.06:44:00-06:45:00.log           stats.06:21:00-06:22:00.log
broker.06:42:00-06:43:00.log              cclink-ie.06:46:00-06:47:00.log           stats.06:25:00-06:26:00.log
broker.06:46:00-06:47:00.log              cclink-ief-basic.06:44:00-06:45:00.log    stats.06:26:00-06:27:00.log
broker.06:47:00-06:48:00.log              cluster.06:41:00-06:42:00.log             stats.06:30:00-06:31:00.log
broker.06:51:00-06:52:00.log              cluster.06:42:00-06:43:00.log             stats.06:31:00-06:32:00.log
broker.06:52:00-06:53:00.log              cluster.06:46:00-06:47:00.log             stats.06:35:00-06:36:00.log
capture_loss.06:17:00-06:18:00.log        cluster.06:47:00-06:48:00.log             stats.06:36:00-06:37:00.log
capture_loss.06:32:00-06:33:00.log        cluster.06:51:00-06:52:00.log             stats.06:40:00-06:41:00.log
capture_loss.06:43:00-06:44:00.log        cluster.06:52:00-06:53:00.log             stats.06:41:00-06:42:00.log
capture_loss.06:47:00-06:48:00.log        files.06:42:05-06:43:00.log               stats.06:45:00-06:46:00.log
capture_loss.06:48:00-06:49:00.log        files.06:44:00-06:45:00.log               stats.06:46:00-06:47:00.log
capture_loss.06:53:00-06:54:00.log        files.06:46:00-06:47:00.log               stats.06:47:00-06:48:00.log
cclink-ie-tsn-ptp.06:43:40-06:44:00.log   files.06:48:00-06:49:00.log               stats.06:50:00-06:51:00.log
cclink-ie-tsn-ptp.06:45:00-06:46:00.log   files.06:50:00-06:51:00.log               stats.06:51:00-06:52:00.log
cclink-ie-tsn-ptp.06:46:00-06:47:00.log   files.06:51:00-06:52:00.log               stats.06:52:00-06:53:00.log
cclink-ie-tsn-ptp.06:47:00-06:48:00.log   files.06:55:00-06:56:00.log               stats.06:55:00-06:56:00.log
cclink-ie-tsn-ptp.06:52:00-06:53:00.log   notice.06:17:00-06:18:00.log              stats.06:56:00-06:57:00.log
cclink-ie-tsn-ptp.06:53:00-06:54:00.log   notice.06:32:00-06:33:00.log              stderr.06:42:01-06:52:01.log
cclink-ie-tsn-slmp.06:43:22-06:44:00.log  notice.06:43:00-06:44:00.log              stdout.06:42:01-06:52:01.log

3.find /usr/local/zeek/logs -name "*.log" -print0 | xargs -0 rmは削除できるかどうかを確認
root@sensor:/usr/local/zeek/logs/2023-10-25# find /usr/local/zeek/logs -name "*.log" -print0 | xargs -0 rm
root@sensor:/usr/local/zeek/logs/2023-10-25# ls -l
total 0
root@sensor:/usr/local/zeek/logs/2023-10-25#
ログが削除できることを確認しました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants