Audit export returns JSON mixed with HTML tags

When I use the Export function in Audit, the Details column is a mix of HTML and JSON.
For example:

<span>{<br>  "Id": "variableset-LibraryVariableSets-76",<br>  "OwnerId": "LibraryVariableSets-76",<br>  "Version": 11</span><del style="background:#ffe6e6;">5</del><ins style="background:#e6ffe6;">6</ins><span><br>}</span>

I understand that this is a way to show what the changes were, but this format is only usable for display in HTML, not for parsing the exported audit via any tools.
Would it be possible to export this as JSON and indicate the change in some other, structural way?
E.g.

{ "Id": "variableset-LibraryVariableSets-76", "OwnerId": "LibraryVariableSets-76", "Version": { "OldValue": 115, "NewValue": 116 } }

Or in any other way which would allow to access this data programatically.

Hi Jakub,

At the moment there is no way of doing this via Octopus as far as I’m, aware but, this could be a suggestion for a UserVoice, I will also point this out to the engineers as a possible feature request.

https://octopusdeploy.uservoice.com/

Fortunately, There are a lot of tools out there that will do this job with ease:

All HTML tags have been removed you all that is left is JSON data.

The tool which I use is:

https://www.browserling.com/tools/html-strip

I hope this helps.

Kind regards,
Ziaul

@Ziaul.Islam I’m sorry, but how does stripping HTML tags help here? Actually it does exactly the opposite, as it removes the <del> and <ins> tags (see my example!) so my example becomes this JSON which in just plain wrong and unusable:

{ "Id": "variableset-LibraryVariableSets-76", "OwnerId": "LibraryVariableSets-76", "Version": 1156 }

(there is no version 1156 at all - it is a change from 115 to 116)

Anyway, I submitted this as https://octopusdeploy.uservoice.com/forums/170787-general/suggestions/39136516-export-audit-as-json.

Hi Jakub,

Extremely sorry for the oversight there.

Thank you for bringing this to my attention.

I see you have posted a UserVoice I will see to it that an engineer has a look at this for a possible feature request.

I hope you have a nice day and if there is anything else I can do for you, please let me know.

Kind regards,
Ziaul

1 Like

Hi, does Octopus actually store the old and new configuration somewhere? How is this audit view generated? I’d like to extract the JSON that was in effect after a specific configuration change, but even the API just returns this HTML-annotated version which is not very helpful. I wrote a tool that downloads the audit trail from the API and removes the del tags, which should be enough, but it seems strange that only the diff view is available.

Hello,

Sorry we didn’t notice this response on the end of an existing thread.

To answer your question. No at the moment that diff is what we store. A decision was made to store it in a format that would display easily. It was only for record keeping, not intended to be used to recover/restore previous versions.

We have thought about re-working it to make it more usable / friendly but it’s still in the ideas stage.

Regards,
Nick

In the end I wrote a CLI tool that produces the old and new JSON from this HTML view (using the REST API), but I’m not 100% sure it will work in all cases (haven’t tested it with special characters, etc.).
I wonder why you decided to go with this pre-rendered diff though. Anything larger than a screen worth of lines is horrible to analyse this way, and even if you manage to see the difference in all that noise, it’s not helpful without a restore option, is it?