Skip to content

Commit 97bd8de

Browse files
authored
Improve documentation for X-Opaque-ID (#46167)
this field can be present in search slow logs and deprecation logs. The docs describes how to enable this functionality and what expect in logs. closes #44851
1 parent 4a0713a commit 97bd8de

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

docs/reference/index-modules/slowlog.asciidoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,41 @@ logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref
8383
logger.index_search_slowlog_rolling.additivity = false
8484
--------------------------------------------------
8585

86+
[float]
87+
==== Identifying search slow log origin
88+
89+
It is often useful to identify what triggered a slow running query. If a call was initiated with an `X-Opaque-ID` header, then the user ID
90+
is included in Search Slow logs as an additional **id** field (scroll to the right).
91+
[source,txt]
92+
---------------------------
93+
[2030-08-30T11:59:37,786][WARN ][i.s.s.query ] [node-0] [index6][0] took[78.4micros], took_millis[0], total_hits[0 hits], stats[], search_type[QUERY_THEN_FETCH], total_shards[1], source[{"query":{"match_all":{"boost":1.0}}}], id[MY_USER_ID],
94+
---------------------------
95+
// NOTCONSOLE
96+
The user ID is also included in JSON logs.
97+
[source,js]
98+
---------------------------
99+
{
100+
"type": "index_search_slowlog",
101+
"timestamp": "2030-08-30T11:59:37,786+02:00",
102+
"level": "WARN",
103+
"component": "i.s.s.query",
104+
"cluster.name": "distribution_run",
105+
"node.name": "node-0",
106+
"message": "[index6][0]",
107+
"took": "78.4micros",
108+
"took_millis": "0",
109+
"total_hits": "0 hits",
110+
"stats": "[]",
111+
"search_type": "QUERY_THEN_FETCH",
112+
"total_shards": "1",
113+
"source": "{\"query\":{\"match_all\":{\"boost\":1.0}}}",
114+
"id": "MY_USER_ID",
115+
"cluster.uuid": "Aq-c-PAeQiK3tfBYtig9Bw",
116+
"node.id": "D7fUYfnfTLa2D7y-xw6tZg"
117+
}
118+
---------------------------
119+
// NOTCONSOLE
120+
86121
[float]
87122
[[index-slow-log]]
88123
=== Index Slow log

docs/reference/setup/logging-config.asciidoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,24 @@ files (four rolled logs, and the active log).
214214
You can disable it in the `config/log4j2.properties` file by setting the deprecation
215215
log level to `error`.
216216

217+
You can identify what is triggering deprecated functionality if `X-Opaque-Id` was used as an HTTP header.
218+
The user ID is included in the `X-Opaque-ID` field in deprecation JSON logs.
219+
[source,js]
220+
---------------------------
221+
{
222+
"type": "deprecation",
223+
"timestamp": "2019-08-30T12:07:07,126+02:00",
224+
"level": "WARN",
225+
"component": "o.e.d.r.a.a.i.RestCreateIndexAction",
226+
"cluster.name": "distribution_run",
227+
"node.name": "node-0",
228+
"message": "[types removal] Using include_type_name in create index requests is deprecated. The parameter will be removed in the next major version.",
229+
"x-opaque-id": "MY_USER_ID",
230+
"cluster.uuid": "Aq-c-PAeQiK3tfBYtig9Bw",
231+
"node.id": "D7fUYfnfTLa2D7y-xw6tZg"
232+
}
233+
---------------------------
234+
// NOTCONSOLE
217235

218236
[float]
219237
[[json-logging]]

0 commit comments

Comments
 (0)