You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by "wangyongqiang0617@163.com" <wa...@163.com> on 2018/09/11 11:29:34 UTC

can not know the process name from zk log

in ZK log, there are some close socket logs as follows:

 [Thread-77061] INFO org.apache.zookeeper.server.NIOServerCnxn.closeSock(1007) -Closed socket connection for client /x.x.x.x:54312 (no session established for client)


from this log info, i can not know the process name, because the port 54312 should be release by the process
is there any useful methods?


wangyongqiang0617@163.com

Re: can not know the process name from zk log

Posted by Andor Molnar <an...@apache.org>.
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


Re: Re: can not know the process name from zk log

Posted by "wangyongqiang0617@163.com" <wa...@163.com>.
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

Re: can not know the process name from zk log

Posted by Michael Han <ha...@apache.org>.
I have a patch that basically did what OP wanted - allows client to pass
more detailed information to server for client tracking. It's a useful
feature, for debugging and in future, for ZK to support multi-tenancy and
enforced quota. I'll try upstream that patch via
https://issues.apache.org/jira/browse/ZOOKEEPER-3147.

On Wed, Sep 12, 2018 at 3:10 AM, Shawn Heisey <ap...@elyograg.org> wrote:

> 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
>
>

Re: can not know the process name from zk log

Posted by Shawn Heisey <ap...@elyograg.org>.
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


Re: Re: can not know the process name from zk log

Posted by "wangyongqiang0617@163.com" <wa...@163.com>.
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



wangyongqiang0617@163.com
 
From: Norbert Kalmar
Date: 2018-09-11 19:39
To: user
Subject: Re: can not know the process name from zk log
Hi,
 
What do you mean by process name?
ZK doesn't know the client process, only the IP address.
If you mean what process has led to connection close (like error in
establishing session), previous logs should be useful.
 
Which version of ZK is this? On mster I see this as debug level log.
 
Regards,
Norbert
 
On Tue, Sep 11, 2018 at 1:29 PM wangyongqiang0617@163.com <
wangyongqiang0617@163.com> wrote:
 
>
> in ZK log, there are some close socket logs as follows:
>
>  [Thread-77061] INFO
> org.apache.zookeeper.server.NIOServerCnxn.closeSock(1007) -Closed socket
> connection for client /x.x.x.x:54312 (no session established for client)
>
>
> from this log info, i can not know the process name, because the port
> 54312 should be release by the process
> is there any useful methods?
>
>
> wangyongqiang0617@163.com
>

Re: can not know the process name from zk log

Posted by Norbert Kalmar <nk...@cloudera.com.INVALID>.
Hi,

What do you mean by process name?
ZK doesn't know the client process, only the IP address.
If you mean what process has led to connection close (like error in
establishing session), previous logs should be useful.

Which version of ZK is this? On mster I see this as debug level log.

Regards,
Norbert

On Tue, Sep 11, 2018 at 1:29 PM wangyongqiang0617@163.com <
wangyongqiang0617@163.com> wrote:

>
> in ZK log, there are some close socket logs as follows:
>
>  [Thread-77061] INFO
> org.apache.zookeeper.server.NIOServerCnxn.closeSock(1007) -Closed socket
> connection for client /x.x.x.x:54312 (no session established for client)
>
>
> from this log info, i can not know the process name, because the port
> 54312 should be release by the process
> is there any useful methods?
>
>
> wangyongqiang0617@163.com
>