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

Chunk and index retention per tenant #162

Closed
aylei opened this issue Dec 19, 2018 · 19 comments
Closed

Chunk and index retention per tenant #162

aylei opened this issue Dec 19, 2018 · 19 comments
Assignees
Labels
component/loki keepalive An issue or PR that will be kept alive and never marked as stale.

Comments

@aylei
Copy link
Contributor

aylei commented Dec 19, 2018

Does loki support chunk and index retention? I'd like to configure the retention time of index and chunks instead of deleting chunks and update the index manually.

And it will be better if retention time could be configured per tenant, which empowers loki as a logging-as-a-service.

@gouthamve
Copy link
Member

Yes, the plan to have retention per tenant. How to implement efficiently needs to be seen. If all tenants have the same retention, deleting old data would be as simple as deleting a table and a bucket once it becomes too old (we cut a new table and bucket every week).

But for retention per tenant, we might need to do Batch deletes which might be costly and take time. It needs to be seen how to do it efficiently. But the good thing is all that the data for each tenant is prefixed with the tenantID.

@aylei
Copy link
Contributor Author

aylei commented Dec 19, 2018

@gouthamve Thanks for the quick and informative response. Despite the efficiency of chunks deleting, which component of loki will actually do the deleting job?

@gouthamve
Copy link
Member

I think it should be part of the table manager (its is a Cortex component that manages the creation of the weekly tables).

@dguendisch
Copy link

Btw, would be great if the planned retention feature could support time-based and volume-based retention at the same time.
A time-based retention (e.g. two weeks) is what I'd use for data privacy reasons, a volume-based is what lets me sleep well as I don't have to fear that loki breaks once a volume becomes full (I'd only loose e.g. some old logs and instead of 14 days of logs I then have temporarily only 12 days of logs, I can then resize the volume during business hours).
If that would work together at the same time, that would be great.

@tklovett
Copy link

tklovett commented May 7, 2019

A time-based log retention policy may be a requirement for use of Loki under the new CCPA regulations. For example, companies may need a strong guarantee that NGINX or application logs containing PII (e.g. UserIDs, I think) will be deleted after 45 / 90 days.

The bill would grant a consumer the right to request deletion of personal information and would require the business to delete upon receipt of a verified request, as specified.
...
(1) A time period for a business to respond to any verified consumer request may be extended by up to 90 additional days where necessary, taking into account the complexity and number of the requests. The business shall inform the consumer of any such extension within 45 days of receipt of the request, together with the reasons for the delay.

- From the The California Consumer Privacy Act of 2018

@thomasf
Copy link

thomasf commented Jun 21, 2019

A time-based log retention policy may be a requirement for use of Loki under the new CCPA regulations.

And the GDPR requires us to be able to purge information regarding speicfic users so we need a way to rewrite logs, maybe even through atomic batch jobs of some sort where all lines are filtered through code if regular expressions aren't enough.

@svparijs
Copy link

svparijs commented Sep 3, 2019

Whats to status of these wishes/requirements? We'd really like to start looking into using Loki for our monitoring/logging production setup. But have some serieus requirements in regards to retention rules per log type, GDPR, etc. And if this is not yet in place is there a roadmap?

@stale
Copy link

stale bot commented Oct 3, 2019

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Oct 3, 2019
@metri
Copy link

metri commented Oct 4, 2019

Please, don't close issue.

@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Oct 4, 2019
@stale
Copy link

stale bot commented Nov 3, 2019

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Nov 3, 2019
@metri
Copy link

metri commented Nov 3, 2019

remove stale

@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Nov 3, 2019
@stale
Copy link

stale bot commented Dec 3, 2019

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Dec 3, 2019
@hassanfarid
Copy link
Contributor

I am unable to make retention work yet. Is this in progress?

I am using loki:1.0.0 with following configurations,

auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 5m
  chunk_retain_period: 30s
  max_transfer_retries: 1

schema_config:
  configs:
  - from: 2018-04-15
    store: boltdb
    object_store: filesystem
    schema: v9
    index:
      prefix: index_
      period: 168h

storage_config:
  boltdb:
    directory: /tmp/loki/index

  filesystem:
    directory: /tmp/loki/chunks

limits_config:
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h

chunk_store_config:
  max_look_back_period: 0

table_manager:
  retention_deletes_enabled: true
  retention_period: 600000ms

@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Dec 4, 2019
@stale
Copy link

stale bot commented Jan 11, 2020

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Jan 11, 2020
@slim-bean slim-bean added the keepalive An issue or PR that will be kept alive and never marked as stale. label Jan 13, 2020
@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Jan 13, 2020
@sudeep1607
Copy link

Is there a plan or road map for this to be implemented?

@cyriltovena
Copy link
Contributor

Yeah this is going to happen first in Cortex and then Loki.

@midnightconman
Copy link

Can we have an update on this, please? Also, please link any related cortex issues / PRs.

Thank you! 😸

@rbel-io
Copy link

rbel-io commented Feb 4, 2021

Isn't the requested feature already implemented?

I would like to see a size-based (in disk storage space) retention rule as well so we could use the following logic:

If the time retention rule or the size retention rule is met, cleanup the Chunk+Index per tenant.

@kubicgruenfeld
Copy link

Cortex got per tenant retention through compactor implemented recently. Not sure if it can be useful in Loki as well the way it is.
cortexproject/cortex#3879

@cyriltovena cyriltovena self-assigned this Apr 1, 2021
periklis added a commit to periklis/loki that referenced this issue Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/loki keepalive An issue or PR that will be kept alive and never marked as stale.
Projects
None yet
Development

No branches or pull requests