You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/02/15 19:52:00 UTC

[jira] [Work logged] (KNOX-2705) Make sure correlation id is passed down in gateway.log

     [ https://issues.apache.org/jira/browse/KNOX-2705?focusedWorklogId=727769&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-727769 ]

ASF GitHub Bot logged work on KNOX-2705:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Feb/22 19:51
            Start Date: 15/Feb/22 19:51
    Worklog Time Spent: 10m 
      Work Description: moresandeep opened a new pull request #536:
URL: https://github.com/apache/knox/pull/536


   ## What changes were proposed in this pull request?
   This PR adds correlation id generated by Knox to gateway logs. In case where a request comes to Knox with header `X-Request-Id` that value is logged instead as trace id. This feature can be turned off by removing `%X{trace_id}` variable from `gateway-log4j2.xml` file.
   
   Correlation is a random UUID or 16 random bytes, in hexadecimal if [generated by nginx](https://www.nginx.com/blog/application-tracing-nginx-plus/). 
   
   One thing to note is that with this PR if correlation id is present it will be logged so it will slightly increase log size. 
   
   ## How was this patch tested?
   Tested locally on single knox instance.
   e.g.
   
   `
   curl -k -u guest:guest-password -X GET -H "X-Request-Id: 1234567890ABCD" https://localhost:8443/gateway/sandbox/webhdfs/v1/tmp/hello.txt\?op\=LISTSTATUS
   `
   
   ```
   ==> /Users/smore/dev/committer/knox/install/knox-2.0.0-SNAPSHOT/logs/gateway.log <==
   2022-02-15 14:05:42,850 1234567890ABCD INFO  knox.gateway (KnoxLdapRealm.java:getUserDn(688)) - Computed userDn: uid=guest,ou=people,dc=hadoop,dc=apache,dc=org using dnTemplate for principal: guest
   
   ==> /Users/smore/dev/committer/knox/install/knox-2.0.0-SNAPSHOT/logs/gateway-audit.log <==
   22/02/15 14:05:43 ||1234567890ABCD|audit|127.0.0.1|WEBHDFS|guest|||authentication|uri|/gateway/sandbox/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS|success|
   22/02/15 14:05:43 ||1234567890ABCD|audit|127.0.0.1|WEBHDFS|guest|||authentication|uri|/gateway/sandbox/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS|success|Groups: []
   22/02/15 14:05:43 ||1234567890ABCD|audit|127.0.0.1|WEBHDFS|guest|||dispatch|uri|http://localhost:50070/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS&user.name=guest|unavailable|Request method: GET
   22/02/15 14:05:44 ||1234567890ABCD|audit|127.0.0.1|WEBHDFS|guest|||dispatch|uri|http://localhost:50070/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS&user.name=guest|failure|
   ```
   
   `curl -k -u guest:guest-password -X GET  https://localhost:8443/gateway/sandbox/webhdfs/v1/tmp/hello.txt\?op\=LISTSTATUS`
   
   ```
   ==> /Users/smore/dev/committer/knox/install/knox-2.0.0-SNAPSHOT/logs/gateway.log <==
   2022-02-15 14:08:39,713 123549b8-8f7f-4301-9d81-dbeefb842652 INFO  knox.gateway (KnoxLdapRealm.java:getUserDn(688)) - Computed userDn: uid=guest,ou=people,dc=hadoop,dc=apache,dc=org using dnTemplate for principal: guest
   
   ==> /Users/smore/dev/committer/knox/install/knox-2.0.0-SNAPSHOT/logs/gateway-audit.log <==
   22/02/15 14:08:39 ||123549b8-8f7f-4301-9d81-dbeefb842652|audit|127.0.0.1|WEBHDFS|guest|||authentication|uri|/gateway/sandbox/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS|success|
   22/02/15 14:08:39 ||123549b8-8f7f-4301-9d81-dbeefb842652|audit|127.0.0.1|WEBHDFS|guest|||authentication|uri|/gateway/sandbox/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS|success|Groups: []
   22/02/15 14:08:39 ||123549b8-8f7f-4301-9d81-dbeefb842652|audit|127.0.0.1|WEBHDFS|guest|||dispatch|uri|http://localhost:50070/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS&user.name=guest|unavailable|Request method: GET
   22/02/15 14:08:40 ||123549b8-8f7f-4301-9d81-dbeefb842652|audit|127.0.0.1|WEBHDFS|guest|||dispatch|uri|http://localhost:50070/webhdfs/v1/tmp/hello.txt?op=LISTSTATUS&user.name=guest|failure|
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 727769)
    Remaining Estimate: 0h
            Time Spent: 10m

> Make sure correlation id is passed down in gateway.log
> ------------------------------------------------------
>
>                 Key: KNOX-2705
>                 URL: https://issues.apache.org/jira/browse/KNOX-2705
>             Project: Apache Knox
>          Issue Type: Bug
>            Reporter: Sandeep More
>            Assignee: Sandeep More
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> This is continuation of KNOX-2704. In case we have a request-id set by upstream component log it in gateway.log



--
This message was sent by Atlassian Jira
(v8.20.1#820001)