Network Management

How to remove/delete OLV logs for specific Nodes and messages.

Over time SQL database clean up is required to remove logs to retrieve spaces and optimize for smooth running. You can use this query for that purpose, or in a situation that a particular host sent too many messages that caused the OLV database to grow in size rapidly

First published date

7/6/2022 8:19 AM

Last published date

2/2/2026 5:32 PM

Overview

This article will guide you to find and delete specific OLV/Log Manager logs of target nodes using SQL query.

 

Product section

Log Analyzer

Resolution

Note: if you plan to use this query, make sure to take a backup of the database before performing the activity.

Below is a query for querying the messages from a specific IP address:
Do change the value of the following in order to get the actual data

IPAddress - Target node IP Address
MessageDateTime must be in MM/DD/YYY HH:MM AM/PM  format as example on the query

-- Scripts are not supported under any SolarWinds support program or service.
-- Scripts are provided AS IS without warranty of any kind. SolarWinds further
-- disclaims all warranties including, without limitation, any implied warranties
-- of merchantability or of fitness for a particular purpose. The risk arising
-- out of the use or performance of the scripts and documentation stays with you.
-- In no event shall SolarWinds or anyone else involved in the creation,
-- production, or delivery of the scripts be liable for any damages whatsoever
-- (including, without limitation, damages for loss of business profits, business
-- interruption, loss of business information, or other pecuniary loss) arising
-- out of the use of or inability to use the scripts or documentation.

SELECT TOP 1000 * FROM [dbo].[OrionLog_LogEntry]
Where LogEntryMessageSourceID IN (Select LogEntryMessageSourceID FROM [dbo].[OrionLog_LogEntryMessageSource] where IPAddress = 'A.B.C.D'
) AND MessageDateTime > '12/30/2021 4:13 AM'

NOTE: You can remove the line if you need to get all the logs for the Target Node.
The line will specifically for selective logs only.
Date and time must be change to reflect the target DateTime using the same format

) AND MessageDateTime > '12/30/2021 4:13 AM'

 
*************************
To delete all the messages from a specific messages: 

-- Scripts are not supported under any SolarWinds support program or service.
-- Scripts are provided AS IS without warranty of any kind. SolarWinds further
-- disclaims all warranties including, without limitation, any implied warranties
-- of merchantability or of fitness for a particular purpose. The risk arising
-- out of the use or performance of the scripts and documentation stays with you.
-- In no event shall SolarWinds or anyone else involved in the creation,
-- production, or delivery of the scripts be liable for any damages whatsoever
-- (including, without limitation, damages for loss of business profits, business
-- interruption, loss of business information, or other pecuniary loss) arising
-- out of the use of or inability to use the scripts or documentation.

Delete FROM [dbo].[OrionLog_LogEntry]
Where LogEntryMessageSourceID IN (Select LogEntryMessageSourceID FROM [dbo].[OrionLog_LogEntryMessageSource] where IPAddress = 'A.B.C.D'
) AND MessageDateTime > '12/30/2021 4:13 AM'

NOTE: You can remove the line if you need to delete all the logs for the Target Node.
The line will specifically for selective logs only.
Date and time must be change to reflect the target DateTime using the same format

) AND MessageDateTime > '12/30/2021 4:13 AM'