dat-ecosystem / dat

:floppy_disk: peer-to-peer sharing & live syncronization of files via command line
https://dat.foundation
BSD 3-Clause "New" or "Revised" License
8.24k stars 449 forks source link

Log friendly output #953

Open SvenDowideit opened 6 years ago

SvenDowideit commented 6 years ago

The dat output to stdout seems to be focused on an interactive terminal, and makes it hard to see what connections, downloads, or other things have happened

In a "get me data" container, it'd be good to have a more transactional log format.

SvenDowideit commented 6 years ago

I just created a private dat share, and I havn't told anyone, or anything about that dat:// - and the connection count changes between 0 and 1, and the UI shows there ai Upload bandwidth being used.

Logging what IP and port is connecting would help with confidence...

joehand commented 6 years ago

I just created a private dat share, and I havn't told anyone, or anything about that dat:// - and the connection count changes between 0 and 1, and the UI shows there ai Upload bandwidth being used.

Whoa we've been seeing this bug randomly but can't reproduce or figure out what's causing it. If you can reproduce regularly, can you do DEBUG=dat*,discovery* dat share and send the output? Thanks!

Logging what IP and port is connecting would help with confidence...

Yes! That'll be in the next release.

joehand commented 6 years ago

In a "get me data" container, it'd be good to have a more transactional log format.

👍

SvenDowideit commented 6 years ago

@joehand are there any other DEBUG options?

Looks to me like adding DEBUG gives me the kind of log file output I want!

SvenDowideit commented 6 years ago

I don't know if this would result in the same connection and upload data, as adding DEBUG removes that UI, but

dow184@TOWER-SL:~/src/dat$ cd secret-dat/
dow184@TOWER-SL:~/src/dat/secret-dat$ dat init
Welcome to dat program!
You can turn any folder on your computer into a Dat.
A Dat is a folder with some magic.

Your dat is ready!
We will walk you through creating a 'dat.json' file.
(You can skip dat.json and get started now.)

Learn more about dat.json: https://github.com/datprotocol/dat.json

Ctrl+C to exit at any time

Title:  dont-share
Description:  this is a dat no-one should know about

Created empty Dat in /home/dow184/src/dat/secret-dat/.dat

Now you can add files and share:
* Run dat share to create metadata and sync.
* Copy the unique dat link and securely share it.

dat://e7bf55abf2b6753d95e0636b2e01c38e6c113ca8cc33b18203b73ef96576b05b
dow184@TOWER-SL:~/src/dat/secret-dat$ touch README
dow184@TOWER-SL:~/src/dat/secret-dat$ DEBUG=dat*,discovery* dat share
  dat Dat DEBUG mode engaged, enabling quiet mode +0ms
  dat dat 13.10.0 +9ms
  dat node v6.11.4 +2ms
  dat Sharing archive { _: [],
  utp: true,
  debug: false,
  quiet: true,
  sparse: false,
  import: true,
  ignoreHidden: true,
  'ignore-hidden': true,
  watch: true,
  logspeed: 400,
  port: 3282,
  dir: '/home/dow184/src/dat/secret-dat' } +0ms
  dat-node archive ready. version: 3 +0ms
  dat-node importFiles() { watch: true,
  dereference: true,
  count: true,
  indexing: true,
  _: [],
  utp: true,
  debug: false,
  quiet: true,
  sparse: false,
  import: true,
  ignoreHidden: true,
  'ignore-hidden': true,
  logspeed: 400,
  port: 3282,
  dir: '/home/dow184/src/dat/secret-dat',
  ignore: [Function: ignore] } +0ms
  discovery-channel whoami() started +0ms
  discovery-channel chan=81bfca..e8 join() +2ms
  dat-node IMPORT ignore: / +95ms
  dat-node IMPORT ignore: /.dat +1ms
  dat-node IMPORT ignore: /.dat/content.bitfield +6ms
  dat-node IMPORT ignore: /.dat/content.key +1ms
  dat-node IMPORT ignore: /.dat/content.signatures +0ms
  dat-node IMPORT ignore: /.dat/content.tree +1ms
  dat-node IMPORT ignore: /.dat/metadata.bitfield +0ms
  dat-node IMPORT ignore: /.dat/metadata.data +1ms
  dat-node IMPORT ignore: /.dat/metadata.key +0ms
  dat-node IMPORT ignore: /.dat/metadata.ogd +0ms
  dat-node IMPORT ignore: /.dat/metadata.signatures +1ms
  dat-node IMPORT ignore: /.dat/metadata.tree +0ms
  dat-node IMPORT put: /README +1ms
  dat-node IMPORT ignore: /.dat/metadata.signatures +12ms
  dat-node IMPORT ignore: /.dat/metadata.tree +0ms
  dat-node IMPORT ignore: /.dat/metadata.data +0ms
  dat-node IMPORT ignore: /.dat/metadata.bitfield +0ms
  dat-node IMPORT skip: /dat.json +1ms
  discovery-channel whoami() succeeded, I am: { port: 3282, host: '140.253.154.71' } +2s
  discovery-channel chan=81bfca..e8 dns announce { port: 3282, publicPort: 3282, multicast: false } +2ms
  discovery-channel chan=81bfca..e8 dht announce +1ms
  discovery-channel chan=undefined dns discovery peer=172.18.0.8:3282 +22s
  discovery-channel chan=81bfca..e8 dns announce { port: 3282, publicPort: 3282, multicast: true } +48s
  discovery-channel chan=81bfca..e8 dns discovery peer=140.253.154.71:3282 +258ms
  discovery-channel chan=81bfca..e8 dns discovery peer=140.253.154.71:3282 +117ms
  discovery-channel chan=undefined dns discovery peer=172.18.0.8:3282 +22s
  discovery-channel chan=undefined dns discovery peer=140.253.154.71:39083 +32s
  discovery-channel chan=81bfca..e8 dns announce { port: 3282, publicPort: 3282, multicast: true } +11s
  discovery-channel chan=81bfca..e8 dns discovery peer=140.253.154.71:3282 +259ms
  discovery-channel chan=81bfca..e8 dns discovery peer=140.253.154.71:3282 +108ms
  discovery-channel chan=undefined dns discovery peer=172.18.0.8:3282 +22s
  discovery-channel chan=undefined dns discovery peer=140.253.154.71:39083 +34s
  discovery-channel chan=81bfca..e8 dns announce { port: 3282, publicPort: 3282, multicast: true } +6s
  discovery-channel chan=81bfca..e8 dns discovery peer=140.253.154.71:3282 +256ms
  discovery-channel chan=81bfca..e8 dns discovery peer=140.253.154.71:3282 +111ms

140.253.154.71:39083 is a different dat share i'm running in the debugger 172.18.0.8:3282 is a datBase I'm running in a container

so maybe its "correct" but its not going to give confidence that private data isn't exposed in ways that the user isn't expecting.