Jump to content
DarrenWhite99

Combine Script Log Entries for easy review or inclusion in a ticket

Recommended Posts

The horribleness that is the new Agent UI Script tile has made Script Log reading a painful experience, but it started a conversation about combining SCRIPT LOG entries when possible. One method would be to defer logging, using a variable to accumulate information and then logging it all at once. Another would be to call your own SQL to append information into an existing entry. I believe this script is superior to both methods. :D

With this script you would use the SCRIPT LOG step as normal. Each time it is used, a new entry will be recorded as normal, no special treatment of logging is needed. At the end of your script you just call this function script;. This script will combine all the script log lines recorded on this computer under the current script id, since the start of this script into 1 entry and delete the other entries. The combined result will also be returned in a variable named "@SCRIPTLOGS@" in case you wanted to email them, attach them to a ticket, etc.

Download Here:   FUNCTION - Consolidate Script Log Entries.zip

Here is an example before the script is called, with the individual SCRIPT LOG entries.ScriptLog-IndividualEntries.jpg.659aeec0d1b94c0afc9c937ae227c1c8.jpg

Here is the Script Log entry after running.

ScriptLog-CombinedEntry.jpg.2e1e380fb9e20c74d88e3701131ca882.jpg

Thank you @johnduprey for the work you did on this idea, which inspired me to create and share this!
combine merge join bundle multiple script log logs logging message messages entries scriptlog scriptlogs entry

  • Thanks 5

Share this post


Link to post
Share on other sites

Can we collect the data in a variable, keep appending things to it, and log it at the end?

 

(Somewhat answered my own ? by collecting a bunch of variables and logging it later, didn't answer append capability).

Edited by Uncle Dave

Share this post


Link to post
Share on other sites
On 4/21/2019 at 3:47 AM, Uncle Dave said:

Can we collect the data in a variable, keep appending things to it, and log it at the end?

Yes, Use Variable Set:Constant

Parameter: @RunningInfo@This is a new line. (It ends with crlf)

Variable: RunningInfo

 

You can self reference a variable as you update it, so it’s contents plus the new information will be assigned. (Just set it to nothing when you start and then you can always add to it )

The problems with this approach are:

* There is no progress as the script runs.

* If the script fails, all gathered data is lost.

* A second script called from the first can overwrite the variable contents. 

 

Thats why I created this solution. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...