zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andor Molnar <an...@apache.org>
Subject Re: can not know the process name from zk log
Date Fri, 14 Sep 2018 10:18:56 GMT
Hi,

What info exactly would you like to see about the client? What do you mean by ‘process info’?

Process name? That’s ‘java’ in 90% of cases and probably not enough to fully identify
the process.
Process ID? 

This information currently not available in ZK, because the client doesn’t send it to the
server.
I think as a workaround you can turn on SASL authentication, so you can see the id of the
authenticated user which might help.

Also, I think revealing client process name and/or PID for the server will raise privacy/security
concerns, but that’s a different question.

Regards,
Andor




> On 2018. Sep 14., at 11:55, wangyongqiang0617@163.com wrote:
> 
> some port is not always be useding by a process, may be used at some time in the past
> so, from the zk log, i want to know which process accessed zk
> 
> 
> 
> wangyongqiang0617@163.com
> 
> From: Shawn Heisey
> Date: 2018-09-12 18:10
> To: user
> Subject: Re: can not know the process name from zk log
> On 9/12/2018 2:33 AM, wangyongqiang0617@163.com wrote:
>> from zk log, i can get the ip and port,  i think if zk can print the process info
with the ip and port , will help us in some cases
> 
> What precisely are you after?  A java program can typically report what 
> PID its process has, but I don't know that any other process information 
> is available.  I have not checked to see whether ZK logs the PID it's 
> using at any point.  Usually such information is logged at startup (if 
> it is ever logged at all) and not anywhere else.
> 
> With the port number, you can use a program like lsof or netstat to 
> determine the pid, and I think this works on both the client and server 
> side.  Here's an example of that for another Java program.  This isn't 
> zookeeper, but the same thing will work for ZK too.
> 
> root@smeagol:~# lsof -Pn -i:45499
> COMMAND  PID     USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
> java    8713 elyograg   35u  IPv6   95610      0t0  TCP 127.0.0.1:45499 
> (LISTEN)
> java    8713 elyograg   62u  IPv6 6442866      0t0  TCP 
> 127.0.0.1:52686->127.0.0.1:45499 (CLOSE_WAIT)
> java    8713 elyograg   67u  IPv6 6443911      0t0  TCP 
> 127.0.0.1:52792->127.0.0.1:45499 (CLOSE_WAIT)
> java    8713 elyograg   78u  IPv6 6446143      0t0  TCP 
> 127.0.0.1:52814->127.0.0.1:45499 (ESTABLISHED)
> java    8713 elyograg   83u  IPv6 6444628      0t0  TCP 
> 127.0.0.1:45499->127.0.0.1:52814 (ESTABLISHED)
> java    8713 elyograg   84u  IPv6 6443524      0t0  TCP 
> 127.0.0.1:52710->127.0.0.1:45499 (CLOSE_WAIT)
> java    8713 elyograg   85u  IPv6 6442460      0t0  TCP 
> 127.0.0.1:52360->127.0.0.1:45499 (CLOSE_WAIT)
> java    8713 elyograg   87u  IPv6 6445101      0t0  TCP 
> 127.0.0.1:52766->127.0.0.1:45499 (CLOSE_WAIT)
> java    8713 elyograg  113u  IPv6 6443962      0t0  TCP 
> 127.0.0.1:52844->127.0.0.1:45499 (ESTABLISHED)
> java    8713 elyograg  119u  IPv6 6444645      0t0  TCP 
> 127.0.0.1:45499->127.0.0.1:52844 (ESTABLISHED)
> java    8713 elyograg  200u  IPv6 6441819      0t0  TCP 
> 127.0.0.1:52656->127.0.0.1:45499 (CLOSE_WAIT)
> 
> The -Pn parameters instruct lsof to not translate port numbers or IP 
> addresses to names.  I do this to make the lsof program run faster.
> 
> Thanks,
> Shawn


Mime
View raw message