apache-top icon indicating copy to clipboard operation
apache-top copied to clipboard

Add reverse or PTR record column

Open altmas5 opened this issue 12 years ago • 3 comments

Add a new column showing the PTR record of the client's IP address. Wich would be the lightest way of doing this avoiding to make a dns lookup each second?

altmas5 avatar Nov 15 '12 21:11 altmas5

I'd rather add it in the same column as it's currently displaying the ip address. However this should not penalize the performance of the display... To do so I'd suggest to do the following:

  • Use some sort of dns cache and cache each entry once it's done. This cache does not need to be persistent and can be stored just in memory. I think there are some implementations already done in python but it should not be so difficult to implement a new one.
  • Each dns query should be asynchronous so it does not stop the main loop. If we still don't have the name resolved when the screen is updated, the ip address should be displayed instead.

thoughts?

fr3nd avatar Nov 16 '12 14:11 fr3nd

It sounds wise. The main challenge is to do the queries in an asynchronous way.

When you say "If we still don't have the name resolved when the screen is updated, the ip address should be displayed instead.", Do you mean the IP address should be replaced with the reverse once it is resolved? I think it would be better to show both when possible (some IPs don't have a PTR record).

You can assign me this issue if you want to.

altmas5 avatar Nov 16 '12 17:11 altmas5

I don't think it makes sense to add a new column to show the same information. At the end what you want to know is the host who is doing the connection, so if you can resolve the fqdn then it should be printed. Otherwise just print the ip.

Also, a commandline parameter to disable this feature would be nice.

fr3nd avatar Nov 22 '12 09:11 fr3nd