-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Issue] Logging using incorrect level when verbose is set up #847
Comments
@reivaxxavier , if i understood this correctly the issues is that gologger logging design is different that expected and is not compatible with your processing system
the usage of format
is common across all pd projects and i think this issue should be addressed as a feature request in gologger repo to make it more standard or option to change this specific behaviour i see you have already created a issue for that at projectdiscovery/gologger#38 . |
I think that this should be reopened.
From what I see, this seems specific to subfinder.
|
Reopening to revisit after projectdiscovery/gologger#38 worked on. |
Thanks for reopening this issue @ehsandeep! I don't think that projectdiscovery/gologger#38 needs to be fixed. This is what #848 intends to do. |
I'm on the same page with gnuletik on this one. The trouble with gologger doesn't really have anything to do with the way subfinder uses the Label function. The thing is, Label function should be given a 'level', not a 'source name'. So, it makes sense to sort this out in subfinder itself, rather than waiting for a fix from gologger. Because, even if gologger comes up with a fix, it's not going to change the fact that the Label usage in subfinder still needs to be fixed. |
@xavier-gerondeau-stoik , @gnuletik the intention behind creating gologger issue is that we can add a option in gologger to strictly behave like a logger and do not accept if any unknown labels are given and if given wrap it (like golang error) ex when that option is implemented gologger.DefaultLogger.Label("securitytrails").Msg("api.hackerone.com") this will return output in below format [VER] securitytrails: api.hackerone.com it might be just me but when i am using subfinder binary in verbose mode i like [SecurityTrails] api.hackerone.com ^ more than [VER] Found subdomain subdomain_source=virustotal subdomain=mta-sts.forwarding.hackerone.com since its simple . and i can easily do some bash foo with that format |
Thanks for the feedback @tarunKoyalwar! Even if the following can be easier to read when running a CLI, the following example is not following any logging convention.
The
This approach even has it full potential when you want to add other fields (we can imagine fields like Also, having a static log message ("Found subdomain") helps when searching among multiple log messages (e.g we can search all "Found subdomain" messages and extract their But I can understand if you want to avoid using Until gologger.DefaultLogger.Msg("securitytrails: api.hackerone.com") |
Describe the bug
Hello there!
I'm encountering a difficulty related to logging in subfinder, which seems to be connected to how gologger handles label and log level. In the piece of code provided below, it seems that whenever an event that includes a label value is logged, this value gets converted to log level during formatting. Is there a specific reasoning behind this design decision?
To illustrate, when I operate subfinder with verbose log level configuration
gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose)
, I encounter numerous logs with a log level that my external logging system cannot process.Subfinder version
2.5.8
Complete command you used to reproduce this
I'm not running the CLI but rather using the lib, but the code below should reproduce this bug
You will then see multiple logs such as :
The problem comes from those lines of code :
subfinder/v2/pkg/runner/enumerate.go
Lines 69 to 72 in 5aca90d
It seems like the Label() method overwrite the level of the log event object. However, here we just want to specify which source found the domain name (while still keeping the event log level at
verbose
).I think this could be easily fixed by using something like
gologger.Verbose().Str("source", result.Source).Msg(subdomain)
The text was updated successfully, but these errors were encountered: