How to export Jira Align On-Premise logs to a zip file using Powershell - copy method
Summary
This article provides a PowerShell script to export Jira Align on-prem logs to a zip file. This can be used to collect and share Jira Align logs.
This script uses a "copy-then-zip" method to avoid potential conflicts with Jira Align's active logging process.
Environment
Jira Align Self-Hosted
Solution
PowerShell Script
⚠️ Run the PowerShell script below as Administrator
$StartDate = Read-Host 'Enter start date (yyyy-MM-dd)'
$EndDate = Read-Host 'Enter end date (yyyy-MM-dd)'
# Filter log files based on creation date
$Files = Get-ChildItem -Path C:\log -File | Where-Object {$_.CreationTime -ge [DateTime]::ParseExact($StartDate,'yyyy-MM-dd',$null) -and $_.CreationTime -lt [DateTime]::ParseExact($EndDate,'yyyy-MM-dd',$null).AddDays(1)}
# Create a temporary directory to store copies of the log files
$TempDir = "C:\temp_logs"
New-Item -ItemType Directory -Path $TempDir -Force # -Force overwrites existing temp directory
# Construct the name of the output zip file
$ZipFileName = "C:\log\JiraAlignLogs_$StartDate"+"_to_"+"$EndDate.zip"
# Copy the filtered log files to the temporary directory
foreach ($File in $Files) {
Copy-Item -Path $File.FullName -Destination $TempDir
}
# Create the zip archive from the files in the temporary directory
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($TempDir, $ZipFileName)
# Clean up the temporary directory
Remove-Item -Path $TempDir -Recurse -Force
Write-Host "Zip file created: $ZipFileName"
Sample Results
Script output at the command line
The zip file generated by the script
The files contained in the zip file with the logs filtered by the date
Updated on April 15, 2025
Was this helpful?
Still need help?
The Atlassian Community is here for you.