HPE OneView
1753359 Members
6740 Online
108792 Solutions
New Discussion

Re: HPOV Script to clear Activity Log files

 
SOLVED
Go to solution
Chris_L1
Advisor

HPOV Script to clear Activity Log files

Good day - is there a simple OneView command/script that can be run to clear the Activity Logs?  I get the daily message of "logs full" at the 75,000 mark.  It is more an annoyance than anything else but if there is a simple command to clear this - I would appreciate any details.

Thanks in advance.

5 REPLIES 5
ChrisLynch
HPE Pro
Solution

Re: HPOV Script to clear Activity Log files

As you stated, the message is annoying and does not prohibit operations from ocurring.  If you wish to remove cleared, old alerts faster than what the appliance will do (which is 1000 at a time today), I will be publishing an update to the HPE OneView 3.0 PowerShell library today (3.0.1293.3770) that will include Remove-HPOVAlert Cmdlet that will help in removing alert resources.  The command could be used:

 

Get-HPOVAlert -State Cleared | Remove-HPOVAlert -Confirm:$false

If you have a lot of alerts, the -Confirm:$false parameter will proceed forward with deleting the alert object.  Omitting it will cause the Remove-HPOVAlert Cmdlet to prompt you for each alert you wish to delete.

 


I am an HPE employee

Accept or Kudo

Chris_L1
Advisor

Re: HPOV Script to clear Activity Log files

Thank you very much!

Chris_L1
Advisor

Re: HPOV Script to clear Activity Log files

Thanks for the addition!  This works great but I noticed that I have to clear the logs in increments.  If I try to do 2000 or more - I receive a JSON error:

Get-HPOVAlert : Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on
the maxJsonLength property.
Parameter name: input
At line:1 char:1
+ Get-HPOVAlert -State Cleared -Count 2000 | Remove-HPOVAlert -Confirm:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-HPOVAlert], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Get-HPOVAlert

I can - successfully - clear 1500 at a time.  So - this works and I appreciate it.  Just wanted to share the limitation I saw.  

ChrisLynch
HPE Pro

Re: HPOV Script to clear Activity Log files

Hmm... I was not aware of that limitation.  Please submit an issue on the project tracker so I can investigate it, and provide a solution.


I am an HPE employee

Accept or Kudo

Chris_L1
Advisor

Re: HPOV Script to clear Activity Log files

I also had the limitation issue - my number was 1791 at a single time.  I was still able to remove all errors except for a couple of dozen in "Error" state.  All pertained to Client Certificate Generation.