loki icon indicating copy to clipboard operation
loki copied to clipboard

Add storage provider for OCI Object Storage

Open ericrrath opened this issue 2 years ago • 10 comments

Is your feature request related to a problem? Please describe. I want to use Loki, but have it store data in Oracle's OCI Object Storage. OCI does have an S3-compatibility mode, but this doesn't support OCI IAM instance principal authentication (i.e. location-based auth).

Describe the solution you'd like I'd like to add the OCI SDK for go as a dependency, then modify Loki to add "native" support for OCI Object Storage (i.e. not through OCI's S3-compatibility mode).

Describe alternatives you've considered Configuring Loki to use its S3 provider pointed to OCI Object Storage's S3-compatibility interface works, but requires me to provide keys to Loki.

Additional context

ericrrath avatar Nov 16 '22 23:11 ericrrath

Is there a working PR for this?

Nitishmane avatar Dec 06 '22 04:12 Nitishmane

@ericrrath Can you provide the storage config you are using for OCI Object Storage?

andytael avatar Jul 14 '23 17:07 andytael

@ericrrath can you share the storage config you used for it?

starboi02 avatar Oct 17 '23 10:10 starboi02

@andytael and @starboi02

  aws:
    access_key_id: d844cd76659fe0d204f1213123asdasdsd
    bucketnames: logging-bucket
    endpoint: https://dasdjkjwi.compat.objectstorage.my-region-1.oraclecloud.com
    http_config:
      insecure_skip_verify: true
    insecure: true
    region: my-region-1
    s3forcepathstyle: true
    secret_access_key: 8sacRn7Akasddasdio21233ksasaM8=

keep in mind that you have to create customer secret key for an user, and assign proper permissions for a group. Good luck!

dzirg44 avatar Nov 14 '23 09:11 dzirg44

I think the above example is not valid anymore as it didn't worked in my case any update on native integration?

Thanks

yaniveliash avatar Feb 20 '24 10:02 yaniveliash

This worked for me with these steps:

schemaConfig:
    configs:
    - from: "2020-09-07"
      store: boltdb-shipper
      object_store: s3
      schema: v11
      index:
        prefix: loki_index_
        period: 24h
storageConfig:
    boltdb_shipper:
      shared_store: s3
      active_index_directory: /var/loki/index
      cache_location: /var/loki/cache
      cache_ttl: 24h
    aws:
      access_key_id: xxxxxx
      bucketnames: lokix402
      endpoint: https://axxxxrg.compat.objectstorage.us-sanjose-1.oraclecloud.com
      s3forcepathstyle: true
      insecure: true
      region: us-sanjose-1
      secret_access_key: "1xxxxxxI="
    filesystem:
      directory: /var/loki/chunks

I can see object in bucket image

krishnarudraraju avatar Feb 28 '24 00:02 krishnarudraraju

@krishnarudraraju It seems like you followed the same steps as I did, but for some reason, it didn't work. Do you have any insights on why that might be?

schema_config:
    configs:
    - from: "2024-05-13"
      store: boltdb-shipper
      object_store: s3
      schema: v11
      index:
        prefix: loki_index_
        period: 24h
 storage_config:
   boltdb_shipper:
     shared_store: s3
     active_index_directory: /var/loki/index
     cache_location: /var/loki/cache
     cache_ttl: 24h
   aws:
     access_key_id: **********
     bucketnames: loki-log
     endpoint: https://f***********
     s3forcepathstyle: true
     insecure: true
     region: eu-frankfurt-1
     secret_access_key: "*********"
   filesystem:
     directory: /var/loki

PrathapDasari avatar May 14 '24 12:05 PrathapDasari

here is my values file

loki:
  auth_enabled: false
  storage:
    bucketNames:
      chunks: log-aggregation-loki
      ruler: log-aggregation-loki
      admin: log-aggregation-loki
    type: s3
    s3:
      s3: null
      endpoint: https://<namespace>.compat.objectstorage.uk-london-1.oraclecloud.com
      region: uk-london-1
      secretAccessKey: "<lokibucket-user-secret-key>"
      accessKeyId: <lokibucket-user-access-key>
      signatureVersion: null
      s3ForcePathStyle: true
      insecure: true
      http_config: {}
lokiCanary:
  nodeSelector:
    node-type: loki
backend:
# -- Number of replicas for the backend
  replicas: 3
  nodeSelector:
    node-type: loki
write:
# -- Number of replicas for the write
  replicas: 3
  nodeSelector:
    node-type: loki
read:
# -- Number of replicas for the read
  replicas: 3
  nodeSelector:
    node-type: loki
gateway:
  nodeSelector:
    node-type: loki
  service:
    type: LoadBalancer

krishnarudraraju avatar May 14 '24 12:05 krishnarudraraju

@krishnarudraraju Thank you for you prompt response :) This is my values file which i am using with default configuration as of now.

loki:
  enabled: true
  isDefault: true
  url: http://{{(include "loki.serviceName" .)}}:{{ .Values.loki.service.port }}
  readinessProbe:
    httpGet:
      path: /ready
      port: http-metrics
    initialDelaySeconds: 45
  livenessProbe:
    httpGet:
      path: /ready
      port: http-metrics
    initialDelaySeconds: 45
  datasource:
    jsonData: "{}"
    uid: ""
  auth_enabled: false
  storage:
     bucketNames:
        chunks: loki
        ruler: loki
        admin: loki
     type: s3
     s3:
       s3: null
       endpoint: https://namesapce.compat.objectstorage.eu-frankfurt-1.oraclecloud.com
       region: eu-frankfurt-1
       secretAccessKey: "x*************"
       accessKeyId: *****************
       signatureVersion: null
       s3ForcePathStyle: true
       insecure: true
       http_config: {}

But still pods are failing with below error

level=error ts=2024-05-14T18:20:32.698748777Z caller=main.go:66 msg="validating config" err="MULTIPLE CONFIG ERRORS FOUND, PLEASE READ CAREFULLY\nCONFIG ERROR: schema v13 is required to store Structured Metadata and use native OTLP ingestion, your schema version is v11. Set allow_structured_metadata: false in the limits_config section or set the command line argument -validation.allow-structured-metadata=false and restart Loki. Then proceed to update to schema v13 or newer before re-enabling this config, search for 'Storage Schema' in the docs for the schema update procedure\nCONFIG ERROR: tsdb index type is required to store Structured Metadata and use native OTLP ingestion, your index type is boltdb-shipper (defined in the store parameter of the schema_config). Set allow_structured_metadata: false in the limits_config section or set the command line argument -validation.allow-structured-metadata=false and restart Loki. Then proceed to update the schema to use index type tsdb before re-enabling this config, search for 'Storage Schema' in the docs for the schema update procedure"

PrathapDasari avatar May 14 '24 13:05 PrathapDasari

@krishnarudraraju thank you for you assistance

I now managed to fix the issue .

loki:
  enabled: true
  isDefault: true
  url: http://{{(include "loki.serviceName" .)}}:{{ .Values.loki.service.port }}
  readinessProbe:
    httpGet:
      path: /ready
      port: http-metrics
    initialDelaySeconds: 45
  livenessProbe:
    httpGet:
      path: /ready
      port: http-metrics
    initialDelaySeconds: 45
  datasource:
    jsonData: "{}"
    uid: ""
  auth_enabled: false
  schemaConfig:
    configs:
    - from: "2024-05-13"
      store: boltdb-shipper
      object_store: s3
      **schema: v13**
      index:
        prefix: loki_index_
        period: 24h
  **limits_config:**
      **allow_structured_metadata: false**
  storage:
     bucketNames:
        chunks: loki
        ruler: loki
        admin: loki
     type: s3
     s3:
       s3: null
       endpoint: https://namespace.compat.objectstorage.eu-*************-1.oraclecloud.com
       region: eu-***********-1
       secretAccessKey: "*********************"
       accessKeyId: ***************************
       signatureVersion: null
       s3ForcePathStyle: true
       insecure: true

PrathapDasari avatar May 14 '24 18:05 PrathapDasari