-
Notifications
You must be signed in to change notification settings - Fork 394
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
base: master
Are you sure you want to change the base?
fix(log-cleanup): Argument list too long #137
Conversation
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 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIND_STATEMENT="find ${BASE_LOG_FOLDER} -type f -mtime \ | |
FIND_STATEMENT="find ${BASE_LOG_FOLDER}/* -name ""*"" -type f -mtime \ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIND_STATEMENT="find ${BASE_LOG_FOLDER}/* -name ""*"" -type f -mtime \
Thanks a lot!
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 anddeleting 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.