How to listen to DHT communication

Hi all…I am trying to see activities around the DHT, I am assuming that if a node holds a content it needs some way to pass this information out to the rest of the network. And I am guessing this starts by telling its peers. I would like to see this communication.

What I have tried is to run ipfs log tail while I add contents to a node, pin it and access it from another node. Doing this, I see entries in the log stream of BlockService.BlockAdded and BlockService.BlockFetched but nothing about a node telling another node that it has some contents

Any ideas on how I can see the DHT communications? Specifically where a node tells it’s peers that certain CID can be retrieved from it?

@dadepo what you are looking for is DHT Provides.

Depending on what level of granularity you are looking for you can either look at logs coming from the provider/reprovider subsystems in IPFS (log subsystem names can be seen in ipfs log ls). Alternatively, you could look at the DHT logs.

I would use ipfs log level <subsystem> debug and monitor the outputs coming out of the daemon.

Does not seem to have the desired effect. So what i did. Ran the following:

ipfs log level providers debug
ipfs log level provider.simple debug
ipfs log level provider.queue debug

Then I monitor the log by doing ipfs log tail still no DHT providers related info is seen. When you say

I am guessing you mean ipfs log tail or is there another way?

Unfortunately, we have two logs at the moment. ipfs log tail follows the event log. Other log entries are sent to stderr by default. If you run ipfs log level provider.simple debug (and reprovider.simple for re-announcements) and look at stderr, you should see relevant log entries.

1 Like

And for me to understand more, what distinguishes the event log, from this other log? I mean on a conceptual level what are the things I should expect to see in the event log, and the things I should expect to see in the other log. I am guessing there is some method to deciding what goes where?

I have a follow up question to this here Getting the CID from DHT related communication

Perhaps you have some thoughts on how to achieve what I want to do?

Hi @dadepo ,
I would be interested in doing the same thing. I have tried but it seems it is not working.
I have tried this on the public network. I set two peers, which can communicate to each other. I set the log verbosity as you said:

ipfs log level providers debug
ipfs log level provider.simple debug
ipfs log level provider.queue debug

I tried to add a file from one peer, and check whether the other peer would see the provding. But is seems that the other peer does not see anything.
I am also wondering whether it can see it, or if this depends on the way the k-buckets are filled when storing the key in the DHT. Could you, please, tell me how you set your peers and the log to get it working?
Thanks a lot.