How to delete logs
Bug Description
I have a flow with 1000 logs and logging stopped. How to continue logging for that flow or how to delete old logs so new ones can be created?
Reproduction
Create 1000 logs, and logging stops
Expected behavior
Logging should continue after 1000 logs
Who can help?
No response
Operating System
Render
Langflow Version
1.0.19.post2
Python Version
3.12
Screenshot
Flow File
No response
To manage the logging behavior in Langflow version 1.0.19.post2, you can set the environment variable LANGFLOW_LOG_RETRIEVER_BUFFER_SIZE to control the number of logs stored. By setting this variable to 1000 or any other desired size, you can ensure that the SizedLogBuffer class maintains a buffer of up to that number of logs. When the buffer reaches this size, it will automatically remove the oldest logs to make space for new ones, allowing continuous logging without manual intervention.
Here's how you can set the environment variable:
export LANGFLOW_LOG_RETRIEVER_BUFFER_SIZE=1000
This will help you continue logging by automatically deleting old logs once the buffer size is reached [1].
To continue talking to Dosu, mention @dosu.
Hey @Gluepower, I believe there is not an easy way to do that in Langflow without changing the backend code, since there is not any specific env variable that controls that.
I believe this limit is being set at https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/services/database/models/transactions/crud.py
So if you want to, you can change internally on your deployment to make it work. Fell free to open a feature request issue describing your request.
wouldn't it make sense to just change the default ordering of timestamps to DESC so that it would always show the last 1000 log entries, instead of always the 1000 first logs?
https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/services/database/models/transactions/crud.py#L20
.order_by(col(TransactionTable.timestamp).desc())
I like the idea by @simonstey. Should I make a small PR for this change? Should there be a configuration option via an environment variable that allows one to choose between descending (desired implementation) and ascending (current implementation) logs?