netdisco / netdisco

A web-based network management tool.
http://netdisco.org/
BSD 3-Clause "New" or "Revised" License
658 stars 75 forks source link

improve application tracing logs #599

Closed inphobia closed 3 weeks ago

inphobia commented 5 years ago

we need more logging 😏

while deleting, logging in and renumbering from the web interface is logged in user_log, a lot of other actions aren't:

everything under port control (those are logged in the portlog, but having a reference in user_log would be handy), creating pseudodevices, creating/deleting manual topology.

haven't checked if anything using snmp set commands except on pseudodev location, which isn't logged either.

Expected Behavior

have more logging for actions which alter devices or config.

Current Behavior

i've only seen login/logout, renumber & delete actions in the user_log.

check_userlog setting does not impact behaviour.

Possible Solution

this is where things get tricky, the actions which are logged have their logging explicitly defined in the function, for example: https://github.com/netdisco/netdisco/blob/ae94440df8c4c2a263a9f6856e8bd81f574fa3d0/lib/App/Netdisco/Util/Device.pm#L120-L124

https://github.com/netdisco/netdisco/blob/ae94440df8c4c2a263a9f6856e8bd81f574fa3d0/lib/App/Netdisco/Web/AuthN.pm#L140-L145

this can be done for other things we want to log, but is a lot of code duplication.

adding function that can be called without setting up the whole schema-> stuff and adding that that to functions we want to be able to log seems like a cleaner option.

if setting('action_log') {
 # and then either a new jq_ function to insert it
 # or something simple like
 pushlog($user, $device, $event, $details); 
}

extending jq functions might also be an option, but also requires to go over all callers. but not all actions use jq (pseudodev for example doesn't)

also, a verbosity option will need to be added to the config so we have at least some control over what gets logged.

Context

things that use jq_ can be found in admin table, but for example editing manual topo doesn't show up there.

what is your take on this?

Your Environment

ollyg commented 3 weeks ago

closed and moved to wishlist