grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.29k stars 3.38k forks source link

404 Page Not Found HTTP API #10268

Open brngates98 opened 1 year ago

brngates98 commented 1 year ago

Describe the bug Keep running into these 404 errors when attempting to use the http api. Loki is ingesting logs from windows and linux without issue however i want to remove a few job names from testing phase to do some clean up. To Reproduce Steps to reproduce the behavior: curl -v -G -X POST 'http://loki.thetmg.com:3100/loki/api/v1/delete' --data-urlencode 'query={job="dmesg"}'

Expected behavior Delete job=dmesg entries

Environment:

server: http_listen_port: 3100 grpc_listen_port: 9096

common: path_prefix: /etc/loki storage: filesystem: chunks_directory: /etc/loki/data/chunks rules_directory: /etc/loki/data/rules replication_factor: 1 ring: instance_addr: 127.0.0.1 kvstore: store: inmemory

frontend: max_outstanding_per_tenant: 8096 compress_responses: true

query_scheduler: max_outstanding_requests_per_tenant: 2048

query_range: results_cache: cache: embedded_cache: enabled: true max_size_mb: 4048

querier: engine: timeout: 10m query_timeout: 10m max_concurrent: 4048

limits_config: enforce_metric_name: false max_cache_freshness_per_query: '10m' reject_old_samples: true reject_old_samples_max_age: 168h split_queries_by_interval: 15m

schema_config: configs:

ruler: alertmanager_url: http://loki.thetmg.com:9009/alertmanager



**Screenshots, Promtail config, or terminal output**
curl http://loki.thetmg.com:3100/loki/api/v1/status/buildinfo
{"version":"HEAD-d819332","revision":"d8193321a","branch":"HEAD","buildUser":"root@84eeedb42522","buildDate":"2023-07-24T14:04:59Z","goVersion":""}

 curl -v -G -X POST 'http://loki.thetmg.com:3100/loki/api/v1/delete'  --data-urlencode 'query={job="dmesg"}'
*   Trying 192.168.70.33:3100...
* Connected to loki.thetmg.com (192.168.70.33) port 3100 (#0)
> POST /loki/api/v1/delete?query=%7Bjob%3D%22dmesg%22%7D HTTP/1.1
> Host: loki.thetmg.com:3100
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Wed, 16 Aug 2023 15:39:30 GMT
< Content-Length: 19
<
404 page not found
* Connection #0 to host loki.thetmg.com left intact
cedric-mgx commented 1 year ago

Is there any news on this?

brngates98 commented 1 year ago

Still gives me 404 errors

On Wed, Aug 30, 2023 at 10:20 AM Cedric-lefebvre-mgx < @.***> wrote:

Is there any news on this?

— Reply to this email directly, view it on GitHub https://github.com/grafana/loki/issues/10268#issuecomment-1699280347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOFQ2CMWXT7C26GIJ2GQ6DLXX5DZ7ANCNFSM6AAAAAA3SXQHCE . You are receiving this because you authored the thread.Message ID: @.***>

cedric-mgx commented 1 year ago

Ok i just managed to get the delete to work by adding:

loki:  
  runtimeConfig:
    overrides:
      fake:
        deletion_mode: "filter-and-delete"
structuredConfig:
  compactor:
    shared_store: s3
    retention_enabled: true

Inside the loki-distributed helm chart. I've been able to query and request deletion as expected now.

brngates98 commented 1 year ago

Ok i just managed to get the delete to work by adding:

loki:  
  runtimeConfig:
    overrides:
      fake:
        deletion_mode: "filter-and-delete"
structuredConfig:
  compactor:
    shared_store: s3
    retention_enabled: true

Inside the loki-distributed helm chart. I've been able to query and request deletion as expected now.

Nice, i wonder how i could apply that to my Loki using docker-compose?

brngates98 commented 1 year ago

Ok i just managed to get the delete to work by adding:

loki:  
  runtimeConfig:
    overrides:
      fake:
        deletion_mode: "filter-and-delete"
structuredConfig:
  compactor:
    shared_store: s3
    retention_enabled: true

Inside the loki-distributed helm chart. I've been able to query and request deletion as expected now.

was able to make it work compactor: retention_enabled: true deletion_mode: "filter-and-delete"