Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add query-frontend config option to log request headers in query logs #5030

Merged
merged 8 commits into from
May 18, 2023

Conversation

pr00se
Copy link
Contributor

@pr00se pr00se commented May 16, 2023

What this PR does

Adds a config option to the query-frontend to specify a list of request headers to include in query logs.

For example, setting -query-frontend.log-query-request-headers="X-Grafana-Org-Id" and sending a query with X-Grafana-Org-Id:1 results in query log lines that include header_x_grafana_org_id=1.

Which issue(s) this PR fixes or relates to

Fixes #4815

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@pr00se pr00se requested review from a team as code owners May 16, 2023 22:17
@pr00se pr00se changed the title Frontend log headers Add query-frontend config option to log request headers in query logs May 16, 2023
@pr00se pr00se force-pushed the frontend-log-headers branch 2 times, most recently from 58f455f to 446839b Compare May 16, 2023 22:22
Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just a few small things

pkg/frontend/transport/handler.go Outdated Show resolved Hide resolved
pkg/frontend/transport/handler.go Outdated Show resolved Hide resolved
Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@56quarters 56quarters merged commit 6439eea into main May 18, 2023
@56quarters 56quarters deleted the frontend-log-headers branch May 18, 2023 15:00
dannykopping pushed a commit to grafana/loki that referenced this pull request Jan 22, 2024
…1499)

**What this PR does / why we need it**:

Adding feature present in mimir, specifically
grafana/mimir#5030.

Adds a config option to the query-frontend to specify a list of request
headers to include in query logs.

For example, setting
-frontend.log-query-request-headers="X-Grafana-Org-Id" and sending a
query with X-Grafana-Org-Id:1 results in query log lines that include
header_x_grafana_org_id=1.

**Which issue(s) this PR fixes**:
Fixes #11422
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
…afana#11499)

**What this PR does / why we need it**:

Adding feature present in mimir, specifically
grafana/mimir#5030.

Adds a config option to the query-frontend to specify a list of request
headers to include in query logs.

For example, setting
-frontend.log-query-request-headers="X-Grafana-Org-Id" and sending a
query with X-Grafana-Org-Id:1 results in query log lines that include
header_x_grafana_org_id=1.

**Which issue(s) this PR fixes**:
Fixes grafana#11422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log value of arbitrary request headers in query frontend stats log
3 participants