Graylog2 / Graylog2/graylog2-server

Incorrect Response in both Archive API and Web Interface

Open
#19,847 0 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
Java
Stars
8.1k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
217

Description

When we try to start another archive operation immediately after initiating an archive operation via the API or on the web UI, the response returned shows the index that is requested to be archived instead of the index that is currently being archived.

## Expected Behavior

If an archiving operation is in progress, when another archiving operation is requested, the response message should return the name of the index that is currently being archived.

## Current Behavior

For example, we sent an API request to archive the graylog_6 index.

**Request:**
```bash
curl -X POST \
https://*****.graylog.cloud/api/plugins/org.graylog.plugins.archive/cluster/archives/graylog_6 \
-H "Content-Type: application/json" \
-H "X-Requested-By: GraylogCloud" \
-u "***********************************************************:token"
```
**Response:**
```json
{"archive_job_config":{"archive_path":"__obsolete__","max_segment_size":524288000,"segment_filename_prefix":"archive-segment","segment_compression_type":"ZSTD","metadata_filename":"archive-metadata.json","histogram_bucket_size":86400000,"restore_index_batch_size":1000,"excluded_streams":[],"segment_checksum_type":"CRC32","backend_id":"65ccd0362a840f74389a5b76","archive_failure_threshold":6,"retention_time":365,"restrict_to_leader":true,"parallelize_archive_creation":false},"system_job":{"id":"9edb0bd0-3cfe-11ef-950b-fefb1a15a742","description":"Archives indices and deletes them","name":"org.graylog.plugins.archive.job.ArchiveCreateSystemJob","info":"Archiving documents in indices: graylog_6. Current index: null","node_id":"200eda80-66d8-4fd0-a674-bedb973218d1","started_at":"2024-07-08T07:49:35.629Z","execution_duration":"PT0S","percent_complete":0,"provides_progress":true,"job_status":"running","is_cancelable":true}}%
```

However, if we immediately send a second archive request after this, the first request is still running and the second archive request is actually for a non-existent index (e.g., graylog_doesnotexist).

**Request:**
```bash
curl -X POST \
https://*******graylog.cloud/api/plugins/org.graylog.plugins.archive/cluster/archives/graylog_doesnotexist \
-H "Content-Type: application/json" \
-H "X-Requested-By: GraylogCloud" \
-u "*********************************************:token"
```

**Response:**
```json
{"type":"ApiError","message":"Archive job for index `graylog_doesnotexist` is already running!"}
```
This response is somewhat misleading because the archiving is actually running for `graylog_6`, and we do not have an index named `graylog_doesnotexist`.
## Possible Solution

Graylog can return the name of the index that is actually being archived instead of the name of the index requested to be archived.

## Steps to Reproduce (for bugs)

1. Initiate an index archiving via WebUI or API
2. While the archiving is in progress, initiate another archiving with existing or non-existing index

## Context

## Your Environment

* Graylog Version: Graylog Cloud 6.0.4 (479)
* Java Version: openjdk 17.0.10 2024-01-16
* OpenSearch Version: 2.12.0
* MongoDB Version: 5.0.26
* Operating System: Host: Cloud Environment, Client: MacOS Sonoma 14.5
* Browser version: Firefox 127.0.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.