How to Safely Clean Up Request Logs for Agents and Workflows in Dify Community Edition? #13374

Closed
opened 2026-02-21 19:11:52 -05:00 by yindo · 5 comments
Owner

Originally created by @liyang0918 on GitHub (Apr 25, 2025).

Originally assigned to: @crazywoola on GitHub.

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

In the Dify community edition, how can the request logs of agents and workflows be safely cleaned up? Currently, due to high usage, the request logs are rapidly growing and consuming a significant amount of disk space.

2. Additional context or comments

Image

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @liyang0918 on GitHub (Apr 25, 2025). Originally assigned to: @crazywoola on GitHub. ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. In the Dify community edition, how can the request logs of agents and workflows be safely cleaned up? Currently, due to high usage, the request logs are rapidly growing and consuming a significant amount of disk space. ### 2. Additional context or comments ![Image](https://github.com/user-attachments/assets/3c04d610-0839-4679-b82e-46ddee9ae95a) ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 🙋‍♂️ question label 2026-02-21 19:11:52 -05:00
yindo closed this issue 2026-02-21 19:11:52 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 25, 2025):

Hello @liyang0918! I'm Dosu, a bot here to help you with bugs, answer your questions, and guide you towards contributing. I'm ready to assist you while we wait for a human maintainer. How can I help you today?

To safely clean up request logs for agents and workflows in the Dify Community Edition, you can run a SQL truncate command on the workflow_app_logs table. This will help manage disk space by deleting all entries in the table. Additionally, Dify uses a RotatingFileHandler for its logging system, which automatically manages log file sizes and backups. You can configure the maximum log file size and the number of backup files through the dify_config.LOG_FILE_MAX_SIZE and dify_config.LOG_FILE_BACKUP_COUNT settings [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 25, 2025): <!-- Greeting --> Hello @liyang0918! I'm [Dosu](https://dosu.dev), a bot here to help you with bugs, answer your questions, and guide you towards contributing. I'm ready to assist you while we wait for a human maintainer. How can I help you today? <!-- Answer --> To safely clean up request logs for agents and workflows in the Dify Community Edition, you can run a SQL truncate command on the `workflow_app_logs` table. This will help manage disk space by deleting all entries in the table. Additionally, Dify uses a `RotatingFileHandler` for its logging system, which automatically manages log file sizes and backups. You can configure the maximum log file size and the number of backup files through the `dify_config.LOG_FILE_MAX_SIZE` and `dify_config.LOG_FILE_BACKUP_COUNT` settings <sup>[[1]](https://github.com/langgenius/dify/issues/14994)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/extensions/ext_logging.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=other)</sup>
Author
Owner

@liyang0918 commented on GitHub (Apr 25, 2025):

Hello @liyang0918! I'm Dosu, a bot here to help you with bugs, answer your questions, and guide you towards contributing. I'm ready to assist you while we wait for a human maintainer. How can I help you today?

To safely clean up request logs for agents and workflows in the Dify Community Edition, you can run a SQL truncate command on the workflow_app_logs table. This will help manage disk space by deleting all entries in the table. Additionally, Dify uses a RotatingFileHandler for its logging system, which automatically manages log file sizes and backups. You can configure the maximum log file size and the number of backup files through the dify_config.LOG_FILE_MAX_SIZE and dify_config.LOG_FILE_BACKUP_COUNT settings [1][2].

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Is it safe enough to directly truncate the workflow_app_logs table? Will this affect API calls for workflows or cause anomalies in the "monitoring" functionality?

@liyang0918 commented on GitHub (Apr 25, 2025): > Hello [@liyang0918](https://github.com/liyang0918)! I'm [Dosu](https://dosu.dev), a bot here to help you with bugs, answer your questions, and guide you towards contributing. I'm ready to assist you while we wait for a human maintainer. How can I help you today? > > To safely clean up request logs for agents and workflows in the Dify Community Edition, you can run a SQL truncate command on the `workflow_app_logs` table. This will help manage disk space by deleting all entries in the table. Additionally, Dify uses a `RotatingFileHandler` for its logging system, which automatically manages log file sizes and backups. You can configure the maximum log file size and the number of backup files through the `dify_config.LOG_FILE_MAX_SIZE` and `dify_config.LOG_FILE_BACKUP_COUNT` settings [[1]](https://github.com/langgenius/dify/issues/14994)[[2]](https://github.com/langgenius/dify/blob/main/api/extensions/ext_logging.py). > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f1f6290a-894f-4797-a0d0-7c84a184f780?feedback_type=other) Is it safe enough to directly truncate the `workflow_app_logs` table? Will this affect API calls for workflows or cause anomalies in the "monitoring" functionality?
Author
Owner

@dosubot[bot] commented on GitHub (Apr 25, 2025):

Truncating the workflow_app_logs table will delete all entries in the table, which can help manage disk space. However, this action may affect the monitoring functionality, as the logs are used for tracking and auditing workflow executions. The logs provide information about the source and creator of the workflow execution, and are integrated with external tools for monitoring and analyzing workflow performance and usage [1][2].

While truncating the table can help with disk space issues, it is important to consider the potential impact on monitoring and any dependencies or relationships with other tables, such as WorkflowRun, Account, and EndUser [1][3]. If monitoring and historical data are important for your use case, you might want to explore alternative log management strategies, such as using the RotatingFileHandler to manage log file sizes and backups [4].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 25, 2025): <!-- Answer --> Truncating the `workflow_app_logs` table will delete all entries in the table, which can help manage disk space. However, this action may affect the monitoring functionality, as the logs are used for tracking and auditing workflow executions. The logs provide information about the source and creator of the workflow execution, and are integrated with external tools for monitoring and analyzing workflow performance and usage <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/models/workflow.py)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/monitoring/integrate-external-ops-tools/integrate-opik.md)</sup>. While truncating the table can help with disk space issues, it is important to consider the potential impact on monitoring and any dependencies or relationships with other tables, such as `WorkflowRun`, `Account`, and `EndUser` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/models/workflow.py)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/b289e2408ee2_add_workflow.py)</sup>. If monitoring and historical data are important for your use case, you might want to explore alternative log management strategies, such as using the `RotatingFileHandler` to manage log file sizes and backups <sup>[[4]](https://github.com/langgenius/dify/blob/main/api/extensions/ext_logging.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=other)</sup>
Author
Owner

@liyang0918 commented on GitHub (Apr 25, 2025):

Truncating the workflow_app_logs table will delete all entries in the table, which can help manage disk space. However, this action may affect the monitoring functionality, as the logs are used for tracking and auditing workflow executions. The logs provide information about the source and creator of the workflow execution, and are integrated with external tools for monitoring and analyzing workflow performance and usage [1][2].

While truncating the table can help with disk space issues, it is important to consider the potential impact on monitoring and any dependencies or relationships with other tables, such as WorkflowRun, Account, and EndUser [1][3]. If monitoring and historical data are important for your use case, you might want to explore alternative log management strategies, such as using the RotatingFileHandler to manage log file sizes and backups [4].

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Indeed, my concern is that directly truncating the workflow_app_logs table might affect other tables that depend on it. Therefore, I hope to find a safer solution from the official source that can address the length issue of the workflow_app_logs table while gracefully handling the migration of related functionalities that rely on this table.

@liyang0918 commented on GitHub (Apr 25, 2025): > Truncating the `workflow_app_logs` table will delete all entries in the table, which can help manage disk space. However, this action may affect the monitoring functionality, as the logs are used for tracking and auditing workflow executions. The logs provide information about the source and creator of the workflow execution, and are integrated with external tools for monitoring and analyzing workflow performance and usage [[1]](https://github.com/langgenius/dify/blob/main/api/models/workflow.py)[[2]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/monitoring/integrate-external-ops-tools/integrate-opik.md). > > While truncating the table can help with disk space issues, it is important to consider the potential impact on monitoring and any dependencies or relationships with other tables, such as `WorkflowRun`, `Account`, and `EndUser` [[1]](https://github.com/langgenius/dify/blob/main/api/models/workflow.py)[[3]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/b289e2408ee2_add_workflow.py). If monitoring and historical data are important for your use case, you might want to explore alternative log management strategies, such as using the `RotatingFileHandler` to manage log file sizes and backups [[4]](https://github.com/langgenius/dify/blob/main/api/extensions/ext_logging.py). > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8acb0820-58e4-48d3-a2e1-050f61230113?feedback_type=other) Indeed, my concern is that directly truncating the `workflow_app_logs` table might affect other tables that depend on it. Therefore, I hope to find a safer solution from the official source that can address the length issue of the `workflow_app_logs` table while gracefully handling the migration of related functionalities that rely on this table.
Author
Owner

@crazywoola commented on GitHub (Apr 26, 2025):

Please take a look at this https://github.com/langgenius/dify/pull/18835

@crazywoola commented on GitHub (Apr 26, 2025): Please take a look at this https://github.com/langgenius/dify/pull/18835
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13374