AEM Error Log Parsing with Environment
AEM ERROR log parsing done using Jenkins on a remote host under various environments. In Jenkins, I have used parameterised build plugin and Powershell plugin
Step-01: User Parameters
Step-02: Password Parameter
Step-03: Host parameter
Step-04: Powershell Build Script
# Stopping the job if it encounters error, ignoring warnings $ErrorActionPreference = 'Stop' $warningPreference = 'SilentlyContinue' # Credentials are stored in env and dynamic variables $SecurePassword = ${ENV:Password} | ConvertTo-SecureString -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential -ArgumentList ${ENV:User}, $SecurePassword # Parameters [String]$AEMENVNUM = (${ENV:myhost} | %{ $_.Split(',')[3]; }) [String]$AEMENV = (${ENV:myhost} | %{ $_.Split(',')[2]; }) [String]$HOSTENV = (${ENV:myhost} | %{ $_.Split(',')[1]; }) [String]$ServerName = (${ENV:myhost} | %{ $_.Split(',')[0]; }) # Logic to parse the error log [ScriptBlock]$SDScriptBlock = { param($AEMENV,$ServerName,$HOSTENV,$AEMENVNUM) write-output "Executing ErrorLogParsing on HOST Environment=${HOSTENV}, AEM Environment=${AEMENV}, AEM Instance Number=${AEMENVNUM}" $PATH = "C:\\Users\\SKYDEVOPS\\Desktop\\testenv\\${AEMENV}\\logserror.log" $OUTPATH = "C:\\Users\\SKYDEVOPS\\Desktop\\backups" $TIMESTAMP = $(get-date -f yyyy_MM_dd_hhmmss) $REGEX = "^.**b(ERROR)b*.*$" select-string -Path $PATH -Pattern $REGEX -AllMatches | % { $_.Matches } | % { $_.Value } | % { $_.substring($_.indexOf(':')+19) } | Get-Unique | Group-object | Format-Table -Wrap -AutoSize -Property Count,Group > ${OUTPATH}\errorLogFilter-$AEMENV-$TIMESTAMP.log } # Invoke a command on the remote machine. Invoke-Command -ComputerName $ServerName -Credential $cred -ScriptBlock ${SDScriptBlock} -ArgumentList $AEMENV,$ServerName,$HOSTENV,$AEMENVNUM
Step-05: Console Output
Step-06: Parsed Log Output
Categories
Adobe Experience Manager, Adobe Experience Manager 6.x, AEM, aem63, Linux, Powershell, Windows Server, Windows Service
Shashi View All
A passionate devops and automation engineer