Convert Script log JSON to DB records #9323

Open
opened 2025-12-29 20:48:26 +01:00 by adam · 2 comments
Owner

Originally created by @arthanson on GitHub (Mar 5, 2024).

NetBox version

v4.0.0

Feature type

Change to existing functionality

Proposed functionality

Currently Script log records are stored as a JSON blob on the Job object, this proposal is to create a ScriptLog Model and use that for storing log records.

Use case

As requested in #10587 There are requests to add filtering and export functionality to Script logs, this would especially be helpful when there are lots of test or log records. This is currently not feasible when they are stored as JSON as the NB code relies on there being querysets to the objects.

Database changes

Create a new ScriptLog object

External dependencies

None

Originally created by @arthanson on GitHub (Mar 5, 2024). ### NetBox version v4.0.0 ### Feature type Change to existing functionality ### Proposed functionality Currently Script log records are stored as a JSON blob on the Job object, this proposal is to create a ScriptLog Model and use that for storing log records. ### Use case As requested in #10587 There are requests to add filtering and export functionality to Script logs, this would especially be helpful when there are lots of test or log records. This is currently not feasible when they are stored as JSON as the NB code relies on there being querysets to the objects. ### Database changes Create a new ScriptLog object ### External dependencies None
adam added the type: featurenetboxstatus: backlogcomplexity: high labels 2025-12-29 20:48:26 +01:00
Author
Owner

@alehaa commented on GitHub (Mar 8, 2024):

Maybe this could be used to return log records while the script is running, too. Then users would get some response about the progress of a long running script.

@alehaa commented on GitHub (Mar 8, 2024): Maybe this could be used to return log records while the script is running, too. Then users would get some response about the progress of a long running script.
Author
Owner

@alehaa commented on GitHub (Jul 28, 2024):

After completion of #15692 it would be nice if we could add this as general JobLogLines to be used by both background jobs and scripts. However, a problem to be covered are transactions, so log entries won't be deleted when the script / job fails.

@alehaa commented on GitHub (Jul 28, 2024): After completion of #15692 it would be nice if we could add this as general `JobLogLines` to be used by both background jobs and scripts. However, a problem to be covered are transactions, so log entries won't be deleted when the script / job fails.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9323