Add option to turn on HTTP debug logging

Created on 15 August 2025, 2 days ago

Problem/Motivation

In older versions of opensearch-project/opensearch-php, logging was enabled, but it was noisy and not 100% compatible with Drupal's logger-channel implementation. Now that we're requiring v2.4, logging is available in the library but not natively implemented by the search_api_opensearch module. It would be nice to be able to turn on debug-logging for all HTTP transactions.

Proposed resolution

OpenSearch\HttpClient\GuzzleHttpClientFactory::create() looks for a configuration element called 'on_client_stack'. If found, it will generate and dispatch an event to modify the Guzzle client stack. If we configure this, we can inject logging middleware into the Guzzle stack. There are several off-the-shelf HTTP logging middleware libraries available on Packagist; I suggest using gmponos/guzzle_logger. We should put this in the โ€˜suggestโ€™ section of the module's composer.json, with the annotation that debugging cannot happen without the presence of this library.

User interface changes

There will be a new "debug" checkbox on the connector configuration page.

API changes

None.

Data model changes

None.

โœจ Feature request
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States daniel_j

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024