Graylog2 / Graylog2/graylog2-server

Grok Pattern "Add" replaces existing text instead of inserting it

Open Beginner friendly
#27,190 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

## Expected Behavior
When creating a new extractor using a Grok Pattern, clicking Add for a Grok Pattern from the list should insert the selected pattern into the text field at the current cursor position.

The existing content of the text field should remain unchanged.

## Current Behavior
When clicking Add for a Grok Pattern from the list, the selected pattern does not simply get appended or inserted into the text field.

Instead, it replaces the last part of the Grok Pattern currently entered in the text field.

## Possible Solution
Insert the selected Grok Pattern into the text field at the current cursor position without replacing existing content.

## Steps to Reproduce (for bugs)
1. Click Create extractor on a message field.
2. Select Grok Pattern as the extractor type.
3. Enter a Grok Pattern into the text field.
4. Select an existing Grok Pattern from the list.
5. Click Add.

Observe that the last part of the existing pattern in the text field is replaced by the selected Grok Pattern.

## Context
When composing a Grok Pattern, the Add button should allow existing Grok Patterns from the list to be inserted into the pattern without losing any content that has already been entered.

Currently, clicking Add unintentionally overwrites part of the existing pattern, which can result in data loss and requires the user to manually restore the overwritten content.

## Your Environment

* Graylog Version: 7.1.8
* Java Version: 21.0.12
* OpenSearch Version: 2.19.5
* MongoDB Version: 7
* Operating System: Debian 12
* Browser version: Firefox + Chrome

## Checklist
[] This issue fix need to be backported.
[] Does this issue have **security** implications?

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue through Create extractor on a message field, selecting Grok Pattern, entering text, and clicking Add on an existing pattern. Trace the extractor UI handling for the Grok Pattern list and verify that Add inserts at the current cursor position while preserving all existing text.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.