netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.38k stars 2.6k forks source link

Journal / Log for Devices (or maybe other Models as well) #151

Closed peelman closed 3 years ago

peelman commented 8 years ago

122 made me think of a situation I ran into when working on an Asset Management system that never got the green light to go open source at a previous gig.

It was requested (and eventually halfway implemented) that I add a Log/Journal/Comments section to each [Item]. This allowed for Human-stamped and Time-Stamped entries to denote maintenance, firmware/software updates, part replacements, or other changes, without having to edit a notes field continuously with something like:

6/30/2016 NP Updated Firmware to version R15.3

The intention was to ease use, enforce consistency (at least in where to make the comment), and safeguard any existing note data that might get wiped out by a select-all-start-typing-without-noticing mishap. The roadmap was to enable those log/journal/comment entires to be created by users of varying roles, whereas somebody might not have permissions to edit the object itself, but could add a note saying what they did to it.

ryanmerolle commented 8 years ago

That would be interesting! Depending on your workflow, it would be very useful escpcially via the API. Given the change workflows I have seen, I could see the following use case dealing with changes pushed or scheduled:

eronlloyd commented 8 years ago

We are using another IPAM for the space serving our subscribers, and it does a great job actually logging the history of IP assignments, which I can see being helpful to troubleshoot if/when the network gets changed around. I would definitely support this, and would like to even get involved with contributing to netbox.

puck commented 7 years ago

Hmmm, something to consider is a journal brings Netbox closer to Asset Management. My plan is to use the Asset module in Request Tracker for the asset side of things, and have Netbox link to RT.

a31amit commented 6 years ago

+1 This feature would be extremely useful track changes on assets some one made.

mikili commented 6 years ago

will this feature be added in the next update of netbox tools? our company is very interested in using netbox and this feature is very important for us. thanks in advance

bdlamprecht commented 6 years ago

Perhaps FR #2511 would solve this type of request without getting too far into the asset management realm.

a31amit commented 5 years ago

2511 would be only useful when someone wanted to do an audit of existing objects but not helpful for the direct users of Web UI whose just wanted to learn information associated with particular objects.

this would really help when someone wanted to track ChangeRequestsID or add services history for sites/Racks/Devices. I believe something like free fall multiple comments similar to many social media or Atlassian confluence documents allow would be useful here.

I believe django.contrib.comments module can be used here.

@jeremystretch Can you please review it and add some timeline for it? It would be really useful when someone can add multiple comments or text log to objects.

jeremystretch commented 5 years ago

@a31amit I review all issues, but I don't provide timelines for any features.

apollo13 commented 5 years ago

@jeremystretch We'd like to see something like this in netbox too and might be able to offer the code for it. Could you outline if this is:

brammeleman commented 5 years ago

Mmm it doesn't look like haminhcong's service-user-panel implements the request discussed here.

DanSheps commented 5 years ago

No, it looks like they are modifying netbox for openstack.

rainerduffner commented 4 years ago

I know that Netbox is primarily an IPAM - but it would be so nice to replace our in-house inventory-management app with this. Except Netbox is missing this one feature that is absolutely critical.

I would be curious to know how others tackle this?

raddessi commented 4 years ago

@rainerduffner we have a <!-- start managed --><!-- end managed --> block in the Comments field for each of our devices. This block is maintained by an external script that updates links to support issues/monitoring links/other items where that device was mentioned for each device that we have, and the area outside that block can be edited by users still like the Comments field was initially meant for.

Having a dedicated section that would have some sort of distinct entry system would be fantastic for us, we would move the contents of the managed section out to a entry that we could in theory keep updated and users would not have to work around our big blob of text when they try to enter notes.

There are some cases we have created custom fields for that this may help with.. for example we have a previous_device_fqdns custom field. It would be a great help if the notes would be parseable or filterable in some way.. but it would probably be easier than trying to parse all of the Comments area which we abandoned in favor of using a custom field for that item.

EDIT: Of course with the new plugins system we could easily split this out on our own, which we may just do in the future.

jeremystretch commented 3 years ago

This is one of our oldest open issues. While I agree that it would be very well-suited as a plugin, it's also a very common use case and worthy of inclusion in core. I'm envisioning a single new model, named JournalEntry. (I'm using the term "journal" here to imply a record created by a human, as opposed to "log" which in our industry tends to imply machine generation.)

class JournalEntry(models.Model):
    content_type = models.ForeignKey(
        to=ContentType,
        on_delete=models.CASCADE
    )
    object_id = models.PositiveIntegerField()
    parent = GenericForeignKey(
        ct_field='content_type',
        fk_field='object_id'
    )
    created = models.DateTimeField(
        auto_now_add=True,
        editable=False
    )
    created_by = models.ForeignKey(
        to=User,
        on_delete=models.SET_NULL,
        related_name='changes',
        blank=True,
        null=True
    )
    content = models.TextField()

We could embed a form directly on each object's primary view to allow the addition of new entries without modifying the object itself. The creation time and associated user would be set automatically. Content would support markdown rendering just as comments do today. A new REST API under /api/extras/ would be added as well.

I want to point out that this introduces two distinct streams of history: We have changes to the NetBox object, recorded in the change log, and now we'll have a journal for separate "real world" changes. The journal might include an entry like "Reassigning IPs using space from provider X", whereas the changelog would show the actual changes being made in NetBox. I think this is tremendously convenient, so long as its clear to users the function of each feature.

ktims commented 3 years ago

@jeremystretch I really like the sound of this model. It would be especially useful if the Journal Entry could (optionally) link to the ChangeLog, perhaps providing a 'reason' field or similar in the edit dialog?

xkilian commented 3 years ago

If desired, I would see what ktims suggests as more of a UI function. When displaying journal entries, there could be a method(some type of quick toggle) to display "change log" entries related to the current journal filter. And not polluting the journal with links back to the change log.

a31amit commented 3 years ago

Can this also be include or be a part of bulk changes as well. so that more than 1 device can be updated with the journal log entry.

darcynz commented 3 years ago

This could be super handy for Rack management as well. Eg a use case for us is recording an entry in the journal when ever permission has been given to a user to access the rack.