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

allow to configure s3 subpath (bucket prefix configuration) #5889

Closed
oneacl opened this issue Apr 12, 2022 · 18 comments · Fixed by #10096
Closed

allow to configure s3 subpath (bucket prefix configuration) #5889

oneacl opened this issue Apr 12, 2022 · 18 comments · Fixed by #10096
Labels
component/storage keepalive An issue or PR that will be kept alive and never marked as stale.

Comments

@oneacl
Copy link

oneacl commented Apr 12, 2022

Is your feature request related to a problem? Please describe.

Currently a full S3 bucket is required for Loki - however, in some situations a bucket may need to be shared with other apps (one example would be aws lightsail where there's a fixed cost per bucket).

Describe the solution you'd like

Ability to specify a folder where all Loki data will be stored in a bucket

I've raised a similar issue with Mimir: grafana/mimir#1682

Thank you.

@arcosx
Copy link
Contributor

arcosx commented Apr 22, 2022

I think this issue is very important and I am facing the same problem.

@arcosx
Copy link
Contributor

arcosx commented Apr 22, 2022

Can this issue be assigned to me? I plan to implement a subpath feature for all object storage (s3,gcs,azure storage....).
I can give a proposal. @kavirajk @owen-d

@fzyzcjy
Copy link

fzyzcjy commented Apr 23, 2022

Facing the same problem. This is very much needed since we are using that bucket for other purposes as well. Making it into a subpath will make it much neater.

@Sylphe88
Copy link

Need the same feature here, so that I can fit all the observability backends in the same bucket (thanos, loki...)!

@stale
Copy link

stale bot commented Aug 13, 2022

Hi! This issue has been automatically marked as stale because it has not had any
activity in the past 30 days.

We use a stalebot among other tools to help manage the state of issues in this project.
A stalebot can be very useful in closing issues in a number of cases; the most common
is closing issues or PRs where the original reporter has not responded.

Stalebots are also emotionless and cruel and can close issues which are still very relevant.

If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry.

We regularly sort for closed issues which have a stale label sorted by thumbs up.

We may also:

  • Mark issues as revivable if we think it's a valid issue but isn't something we are likely
    to prioritize in the future (the issue will still remain closed).
  • Add a keepalive label to silence the stalebot if the issue is very common/popular/important.

We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task,
our sincere apologies if you find yourself at the mercy of the stalebot.

@callmeteus
Copy link

Bumping it cause we are having the same problem.

@zerda
Copy link

zerda commented Sep 9, 2022

Loki communicates with the S3 bucket using the BucketClient from github.com/thanos-io/thanos/pkg/objstore/s3.

Since thanos-io/thanos#5337 has been merged, implementing bucket prefix in loki should be much simpler.

@dannykopping dannykopping added the keepalive An issue or PR that will be kept alive and never marked as stale. label Sep 28, 2022
@oneacl
Copy link
Author

oneacl commented Dec 14, 2022

@dimitarvdimitrov - thank you for grafana/mimir#1686

was wondering if there are any plans to retrofit this into loki as well?

Thank you.

@nicon89
Copy link

nicon89 commented Dec 17, 2022

Is there any update on this?

@davinkevin
Copy link

+1000 on this one! Really important when you want to backup a complete monitoring bucket with all [metrics|traces|logs] in the same state.

@rpartapsing
Copy link

Is there any update on this one?

@eddiewong007
Copy link

Any updates? Really need this feature to keep it align with mimir and tempo!

@matschaffer-roblox
Copy link
Contributor

matschaffer-roblox commented Aug 23, 2023

I currently set up one loki per k8s cluster (via the helm chart) and this would be handy to allow all my clusters in a given environment (dev, prod, etc) to have a common log storage bucket rather than ENV x CLUSTER buckets.

For now I'll just live with the dozen or so extra buckets produced by the above multiplication.

slim-bean added a commit that referenced this issue Oct 31, 2023
**What this PR does / why we need it**:

Adds a new option under the aws stanza named key_prefix. This is useful
if you have many Loki installations and do not want to create a million
buckets. This is different than `compactor.shared_store_key_prefix`
because it also affects eg the `loki_cluster_seed.json` file.

**Which issue(s) this PR fixes**:
Fixes #5889

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [x] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [x] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [ ] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](d10549e)

---------

Signed-off-by: Edward Welch <edward.welch@grafana.com>
Co-authored-by: Ed Welch <edward.welch@grafana.com>
@dragonball-wooboo
Copy link

Is there any update on this one?

@rubenvw-ngdata
Copy link
Contributor

Also interested in how this is done for the helm chart. Is it documented somewhere?

@adil-jeel
Copy link

Is there any update on this one?

@awoimbee
Copy link

awoimbee commented Mar 20, 2024

Hi, I'm a bit lost, I want to use this feature that should be available since #10096 got merged (it's in the code) but with loki 2.9.4 I get:

failed parsing config: /etc/loki/config/config.yaml: yaml: unmarshal errors:
  line 71: field object_prefix not found in type storage.Config

I set loki.storage_config.object_prefix to loki/ in the helm chart, it translates in the loki configmap to storage_config.object_prefix.

A quick search of the issues show that people use this feature, but how can it work if it's not accepted by storage.Config ?
strings ~/Downloads/loki-linux-amd64 | grep -E '[Oo]bject_?[Pp]refix' | grep -v -E '[lL]og_?[Oo]bject' returns nothing ?

EDIT: goddammit there is a release-2.9.x branch, using the main branch works

@tculp
Copy link

tculp commented Mar 20, 2024

On that note, this feature has now been merged to main for nearly 5 whole months but not included in 2.9.3, 2.9.4, or 2.9.5. Could this please get included in a release, and also updated in the helm chart, added to documentation, etc?

@slim-bean I see you're the one who merged the original feature, so I'm tagging you for visibility

rhnasc pushed a commit to inloco/loki that referenced this issue Apr 12, 2024
…a#10096)

**What this PR does / why we need it**:

Adds a new option under the aws stanza named key_prefix. This is useful
if you have many Loki installations and do not want to create a million
buckets. This is different than `compactor.shared_store_key_prefix`
because it also affects eg the `loki_cluster_seed.json` file.

**Which issue(s) this PR fixes**:
Fixes grafana#5889

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [x] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [x] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [ ] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](grafana@d10549e)

---------

Signed-off-by: Edward Welch <edward.welch@grafana.com>
Co-authored-by: Ed Welch <edward.welch@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/storage keepalive An issue or PR that will be kept alive and never marked as stale.
Projects
None yet
Development

Successfully merging a pull request may close this issue.