System Center Orchestrator – SQL Query to show log file data

SystemCenter logo

Last updated on June 10th, 2023 at 02:02 pm

Read Time:1 Minute, 10 Second

If you are using System Center Orchestrator (SCORCH)  Runbooks then you may have run into issues where the database is increasing in size due to the large amount of log files being created. This typically occurs when monitoring event logs on servers amongst some other runbook options in SCORCH.

If you want to check how many log files are in existence per each individual runbook that you have, then you can run the following SQL query on your SCORCH database.

SQL Query

SELECT COUNT(OBJECTS.Name) AS Instances,
POLICIES.Name AS Runbook, 
Objects.Name 
FROM OBJECTINSTANCEDATA
INNER JOIN OBJECTINSTANCES ON OBJECTINSTANCEDATA.ObjectInstanceID = OBJECTINSTANCES.UniqueID
INNER JOIN OBJECTS ON OBJECTINSTANCES.ObjectID = OBJECTS.UniqueID
INNER JOIN POLICIES ON OBJECTS.ParentID = POLICIES.UniqueID
GROUP BY Policies.Name,
Objects.Name
ORDER BY Instances DESC

Running this will bring back a list of your existing runbooks and the total amount of logs against each one. You can then purge logs manually or re-evaluate your automated log purge settings within the Runbook Designer Console.

More Queries

Our full range of SQL and WQL Collection queries are available here.

Feedback

If you have any questions or feedback about this post, or if you would like us to create any queries for you, please go ahead and leave us a message below in the comments section and we will get back to you as quick as we can.

Click to rate this post!
[Total: 1 Average: 5]

Free Subscription

If you want to be notified when we post more quality guides like this one, sign up to our free subscription service and you will receive an email when a new post is live.

Join 441 other subscribers.

No need to worry, we will not be filling your inbox with spam and you can unsubscribe anytime you like.


Leave us a message...

This site uses Akismet to reduce spam. Learn how your comment data is processed.