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

'--log-to' option doesn't work properly #314

Closed
snooppr opened this issue Oct 28, 2023 · 2 comments
Closed

'--log-to' option doesn't work properly #314

snooppr opened this issue Oct 28, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@snooppr
Copy link

snooppr commented Oct 28, 2023

  1. bandwhich --help

Options:
-i, --interface The network interface to listen on, eg. eth0
-r, --raw Machine friendlier output
-n, --no-resolve Do not attempt to resolve IPs to their hostnames
-s, --show-dns Show DNS queries
-d, --dns-server <DNS_SERVER> A dns server ip to use instead of the system default
--log-to <LOG_TO> Enable logging to a file
-v, --verbose... More output per occurrence
-q, --quiet... Less output per occurrence
-p, --processes Show processes table only
-c, --connections Show connections table only
-a, --addresses Show remote addresses table only
-t, --total-utilization Show total (cumulative) usages
-h, --help Print help
-V, --version Print version

All options have an abbreviation, except for the logging option. Add a shortcut to this option as well: '-l'

2.sudo bandwhich --log-to test
The band itself monitors traffic and displays all the stated metrics successfully in the CLI (the process that loads the network). But something completely different is written into the log file (complete nonsense).
cat test

07:07:16 [WARN] Cannot determine which process owns tcp://192.168.43.27:49686.
07:08:02 [WARN] Cannot determine which process owns tcp://192.168.43.27:42410.
07:08:02 [WARN] Cannot determine which process owns tcp://192.168.43.27:42412.
07:08:02 [WARN] Cannot determine which process owns tcp://192.168.43.27:42414.
07:08:02 [WARN] Cannot determine which process owns tcp://192.168.43.27:42416.
07:08:23 [WARN] Cannot determine which process owns tcp://192.168.43.27:40488.
07:08:43 [WARN] Cannot determine which process owns tcp://192.168.43.27:51998.
07:08:47 [WARN] Cannot determine which process owns tcp://192.168.43.27:40486

Fix, "bandwhich" should write to the log what it captures in the CLI. This problem greatly spoils the functionality of the utility and forces you to use other GNU/Linux tools, of which, unfortunately, there are few.

OS used is Debian, bandwhich v0.21.1 (installed from source).

p/s/ Before the bandwhich 0.21.1 version from the source code, I tested the bandwhich 0.21.1 version from Snap. Unfortunately, bandwhich from snap does not display the name of the process that creates network activity (I don’t know who collects the package versions for snap, but bandwhich 0.21.1 from there is not working). This is just a word.

@cyqsimon
Copy link
Collaborator

  1. The --log-to option is meant for debugging use. Normal users shouldn't have to touch it unless they encounter problems. This is why I refrained from giving it a short flag.

I suppose the description is indeed a bit vague; better might be ”enable debug logging to a file". I can change that.

  1. From your description of what you intend to do, I think what you are looking for is the --raw option.

As of the issue you ran into with snap, I assume it is a permission issue. Process resolution on Linux requires direct access to procfs, which the snap may not have been configured to allow. This is something you'd have to ask Ubuntu packagers to fix.

@cyqsimon cyqsimon added the documentation Improvements or additions to documentation label Oct 28, 2023
@snooppr
Copy link
Author

snooppr commented Oct 28, 2023

From your description of what you intend to do, I think what you are looking for is the --raw option.

Yes thank you! This is what you need.
s̶u̶d̶o̶ ̶b̶a̶n̶d̶w̶h̶i̶c̶h̶ ̶-̶-̶l̶o̶g̶-̶t̶o̶ ̶t̶e̶s̶t̶
sudo bandwhich --raw > test

I'm closing the issue.

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

No branches or pull requests

2 participants