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

fix(log-cleanup): Argument list too long #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dallyger
Copy link

@dallyger dallyger commented Jul 13, 2023

Airflow instances with a lot of DAG runs create lots of small log files.
The find command is able to search for patterns, iterating over and
deleting them. However, the old way would use the shell's globbing
feature and pass the directories to check for as individual arguments.
This can cause an "Argument list too long" error.

MicrosoftTeams-image

Airflow instances with a lot of DAG runs create lots of small log files.
The `find` command is able to search for patterns, iterating over and
deleting them. However, the old way would use the shell's globbing
feature and pass the directories to check for as individual arguments.
This may caused an "Argument list too long" error.
@@ -175,20 +175,23 @@
echo ""
echo "Running Cleanup Process..."

FIND_STATEMENT="find ${BASE_LOG_FOLDER}/*/* -type f -mtime \
# Delete log files
FIND_STATEMENT="find ${BASE_LOG_FOLDER} -type f -mtime \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FIND_STATEMENT="find ${BASE_LOG_FOLDER} -type f -mtime \
FIND_STATEMENT="find ${BASE_LOG_FOLDER}/* -name ""*"" -type f -mtime \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is enough to fix the issue. And find statement for empty folders should be fine

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may commit this change if you want, but I see no difference there. The -name only adds a check which should always be true. Appending the /* should also have no effect, as the -type f check will ensure, we only delete files anyway.

We run this patch internally for quite some time now without any issues.
Deleting around 8k files a day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants