i want to add a custom key/value pair to the access log, as https://docs.vespa.ai/en/access-logging.html
test is
@Override
public HttpResponse handle(HttpRequest request) {
Result result = null;
try {
String queryString = properties.getOrDefault("query", "");
Query query = new Query("?query=" + encode(queryString, StandardCharsets.UTF_8));
query.getContext(true).logValue("this_is_key", "this_is_value");
return response(query.toDetailString(), 200);
} catch (Exception e) {
log.log(Level.SEVERE, e.getMessage(), e);
}
return response("Error handling search request", 400);
}
output: qrs/JsonAccessLog.container
{"ip":"172.20.0.1","time":1625813285.167,"duration":0.011,"responsesize":61,"requestsize":0,"code":200,"method":"GET","uri":"/test/","version":"HTTP/1.1","agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36","host":"localhost:8080","scheme":"http","localport":8080,"peeraddr":"172.20.0.1","peerport":42082}
i can't find below element in the accss log
"attributes": { "this_is_key": "this_is_value" }
what's the problem?