langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
35.54k stars 4.23k forks source link

How to delete logs #4297

Closed Gluepower closed 4 hours ago

Gluepower commented 4 weeks ago

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

image

Flow File

No response

dosubot[bot] commented 4 weeks ago

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.

joaoguilhermeS commented 4 days ago

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.