Skip to content

Search request/response headers should be DEBUG level, not INFO #33924

Open

Description

Is your feature request related to a problem? Please describe.

We are seeing overly verbose output when using INFO level logging in our Python applications:

2024-01-19 20:24:10 (INFO) azure.core.pipeline.policies.http_logging_policy: Request URL: 'https://gptkb-ifvo2edlwe6vw.search.windows.net/indexes('gptkbindex')/docs/search.post.search?api-version=REDACTED'
Request method: 'POST'
Request headers:
    'Content-Type': 'application/json'
    'Content-Length': '27'
    'Accept': 'application/json'
    'x-ms-client-request-id': 'b399733a-b708-11ee-ae3d-002248c0058c'
    'User-Agent': 'azsdk-python-search-documents/11.4.0 Python/3.11.7 (Linux-6.2.0-1018-azure-x86_64-with-glibc2.36)'
    'Authorization': 'REDACTED'
A body is sent with the request
2024-01-19 20:24:14 (INFO) azure.core.pipeline.policies.http_logging_policy: Response status: 200
Response headers:
    'Transfer-Encoding': 'chunked'
    'Content-Type': 'application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8'
    'Content-Encoding': 'REDACTED'
    'Vary': 'REDACTED'
    'Server': 'Microsoft-IIS/10.0'
    'Strict-Transport-Security': 'REDACTED'
    'Preference-Applied': 'REDACTED'
    'OData-Version': 'REDACTED'
    'request-id': 'b399733a-b708-11ee-ae3d-002248c0058c'
    'elapsed-time': 'REDACTED'
    'Date': 'Fri, 19 Jan 2024 20:24:11 GMT'

I believe this is coming from azure-documents-search, from this line of code:

    search_client = SearchClient(
        endpoint=f"https://{os.environ['AZURE_SEARCH_SERVICE']}.search.windows.net",
        index_name=os.environ["AZURE_SEARCH_INDEX"],
        credential=azure_credential,
    )
    r = search_client.search("", top=1000)

We're also surprised by the number of REDACTED headers, but we wouldn't be worried if we just didn't see them at all.

Describe the solution you'd like

We think those headers should be at DEBUG level. Similar headers are shown at DEBUG level for other SDKs.

Describe alternatives you've considered

We've considered using print() instead of logging.info() so that we don't have to see these logs, but it's better practice to use info().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Azure.CoreClientThis issue points to a problem in the data-plane of the library.Searchfeature-requestThis issue requires a new behavior in the product in order be resolved.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

  • Status

    Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions