You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "tomscut (Jira)" <ji...@apache.org> on 2020/05/30 10:13:00 UTC
[jira] [Created] (HDFS-15380) Could not fetch real remote ip in
RouterWebHdfsMethods.java
tomscut created HDFS-15380:
------------------------------
Summary: Could not fetch real remote ip in RouterWebHdfsMethods.java
Key: HDFS-15380
URL: https://issues.apache.org/jira/browse/HDFS-15380
Project: Hadoop HDFS
Issue Type: Bug
Components: webhdfs
Affects Versions: 3.1.0
Reporter: tomscut
Fix For: 3.4.0
Attachments: PATCH
We plan to add audit log for hdfs router, then we fetch remote ip via Server.getRemoteIp(), but the result is "localhost/127.0.0.1".
"REMOTE_ADDRESS" in RouterWebHdfsMethods.java is a ThreadLocal field, setting in construction method RouterWebHdfsMethods() and init(). When we call method Server.getRemoteIp() to fetch remote ip, the thread would be changed, so the ThreadLocal field "REMOTE_ADDRESS" is null, and would be passed to "localhost/127.0.0.1" via InetAddress.getByName().
So we can change this field "REMOTE_ADDRESS" to a String value, just like NamenodeWebHdfsMethods does.
{code:java}
2020-05-27 19:15:18,797 INFO router.RouterWebHdfsMethods (RouterWebHdfsMethods.java:<init>(138)) - RouterWebHdfsMethods REMOTE_ADDRESS: 14.39.39.28, current thread: qtp476579021-10902020-05-27 19:15:18,827 INFO router.RouterWebHdfsMethods (RouterWebHdfsMethods.java:init(150)) - init REMOTE_ADDRESS: 14.39.39.28, current thread: qtp476579021-10902020-05-27 19:15:18,836 INFO router.RouterWebHdfsMethods (RouterWebHdfsMethods.java:getRemoteAddr(170)) - getRemoteAddr REMOTE_ADDRESS: null, current thread: IPC Server handler 75 on 88882020-05-27 19:15:18,837 INFO router.RouterWebHdfsMethods (RouterWebHdfsMethods.java:getRemoteAddr(170)) - getRemoteAddr REMOTE_ADDRESS: null, current thread: IPC Server handler 75 on 88882020-05-27 19:15:18,883 INFO router.RouterWebHdfsMethods (RouterWebHdfsMethods.java:reset(164)) - reset REMOTE_ADDRESS: null, current thread: IPC Server handler 75 on 8888
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org