Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add peerlog plugin #6887

Merged
merged 5 commits into from
Feb 10, 2020
Merged

feat: add peerlog plugin #6887

merged 5 commits into from
Feb 10, 2020

Conversation

olizilla
Copy link
Member

add a plugin to log just PeerIDs for nodes we connect to, to allow us to see how many unique peers a node connects to over time.

It's set up a preloaded plugin, so it would be enabled by default. We may want to extract it to a seperate repo so we can make it an optional add on.

Usage

$ GOLOG_FILE=~/peer.log IPFS_LOGGING_FMT=json ipfs daemon

Output

{"level":"info","ts":"2020-02-10T13:54:26.639Z","logger":"plugin/peerlog","caller":"peerlog/peerlog.go:51","msg":"connected","peer":"QmS2H72gdrekXJggGdE9SunXPntBqdkJdkXQJjuxcH8Cbt"}
{"level":"info","ts":"2020-02-10T13:54:59.095Z","logger":"plugin/peerlog","caller":"peerlog/peerlog.go:56","msg":"disconnected","peer":"QmS2H72gdrekXJggGdE9SunXPntBqdkJdkXQJjuxcH8Cbt"}

License: MIT
Signed-off-by: Oli Evans oli@tableflip.io

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
adds a plugin to log just peerIDs for nodes we connect to, to allow us to see how many unique peers a node connects to over time.

It's set up a preloaded plugin, so it would be enabled by default. We may want to extract it to a seperate repo so we can make it an optional add on.

**Usage**

```console
$ GOLOG_FILE=~/peer.log IPFS_LOGGING_FMT=json ipfs daemon
```

**output**

```json
{"level":"info","ts":"2020-02-10T13:54:26.639Z","logger":"plugin/peerlog","caller":"peerlog/peerlog.go:51","msg":"connected","peer":"QmS2H72gdrekXJggGdE9SunXPntBqdkJdkXQJjuxcH8Cbt"}
{"level":"info","ts":"2020-02-10T13:54:59.095Z","logger":"plugin/peerlog","caller":"peerlog/peerlog.go:56","msg":"disconnected","peer":"QmS2H72gdrekXJggGdE9SunXPntBqdkJdkXQJjuxcH8Cbt"}
```

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
plugin/loader/preload_list Outdated Show resolved Hide resolved
plugin/plugins/peerlog/peerlog.go Outdated Show resolved Hide resolved
@Stebalien
Copy link
Member

Ok, I've fixed those issues. Let's see if this builds.

@Stebalien
Copy link
Member

Note: to enable the plugin, you now need to build with make build IPFS_PLUGINS="peerlog".

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as long as this works for you.

@olizilla
Copy link
Member Author

Neat! Merge at will.

@Stebalien Stebalien merged commit aae957a into master Feb 10, 2020
@Stebalien Stebalien deleted the peerlog-plugin branch February 10, 2020 22:54
@momack2
Copy link
Contributor

momack2 commented Feb 11, 2020

🙌🚀❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants