Home Analyst Portal

CacheBuilder Log Refresh

Matthew_DowstMatthew_Dowst Customer IT Monkey ✭
edited August 2016 in Analyst Portal
During a deployment I often find myself restarting the CacheBuilder and watching the log for changes. To make things easier on myself I wrote a quick PowerShell script to stop the service, rename the current log with the current timestamp, and start the service again. This gives me a nice clean log to look through for my troubleshooting. I thought I would share the script here in case anyone else would find it useful.


# Rename current log with timestamp<br>&nbsp;&nbsp;&nbsp; Rename-Item $CacheBuilder "CacheBuilder_$((Get-Date).ToFileTime()).log"<br><br>    # Start CacheBuilder<br>&nbsp;&nbsp;&nbsp; Start-Service CacheBuilder<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp; Write-Output "CacheBuilder.log was not found in $Folder"<br>}# Enter the folder that contains the CacheBuilder.log file<br>$Folder = "C:\InetPub\CiresonPortal\bin\Logs"<br><br>$CacheBuilder = Join-Path $Folder "CacheBuilder.log"<br>If(Test-Path $CacheBuilder)<br>{<br>&nbsp;&nbsp;&nbsp; #Stop CacheBuilder<br>&nbsp;&nbsp;&nbsp; Stop-Service CacheBuilder<br>&nbsp;&nbsp;&nbsp; Start-Sleep 3<br><br>    

Comments

  • Joe_BurrowsJoe_Burrows Cireson Devops Super IT Monkey ✭✭✭✭✭
    Nice! Thanks for sharing @Matthew_Dowst :)

  • Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭
    I'd like to bump this and recommend putting it into some kind of automation.  Even if it's just Task Scheduler.  Keeping the cachebuilder.log and Webconsole.log file smaller(and current) makes troubleshooting much easier.
  • Matt_MedleyMatt_Medley Member Advanced IT Monkey ✭✭✭
    I'd like to bump this and recommend putting it into some kind of automation.  Even if it's just Task Scheduler.  Keeping the cachebuilder.log and Webconsole.log file smaller(and current) makes troubleshooting much easier.
    I like the idea of having it as some type of weekly task. Some of these logs get rather large and skimming through them quickly can be a pain. 
  • Mike_StormsMike_Storms Customer Adept IT Monkey ✭✭
    we you have access to splunk... looking through them no matter what the size has made it easier for us to troubleshoot issues...
  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭
    One thing to keep in mind is that the cachebuilder has a set limit of 100MB in the config file. By running this command it create more files that will increase your disk requirements. (I do agree with smaller files for T/S reasons) 
    To combat the logging disk requirements for my entire SCSM/Cireson farm. I have an old vbs script that also runs nightly to clear older files. 
    This below script helps with the Cireson IIS logging enabled by default. (I have to update my to hourly otherwise the logs get so big it crashes the system)
    *******************************
    Option Explicit

    On Error Resume Next

    Dim fso, folder, files
    Dim sFolder1
    Dim folderIdx

    'here is where you assign your folder names

    sFolder1 = "C:\inetpub\logs\LogFiles\W3SVC1"



    Set fso = CreateObject("Scripting.FileSystemObject")


    Set folder = fso.GetFolder(sFolder1)
    Set files = folder.Files

    For each folderIdx In files
      if DateDiff("d", Now, folderIdx.DateLastModified) < -29 then folderIdx.Delete

    Next

    Set fso = Nothing
    Set folder = Nothing
    Set files = Nothing
    *******************************

Sign In or Register to comment.