Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Structured Log Report Generator

Overview

The report generator was originally designed to consume the structured log format produced by the NAS Backup Automation Framework but can be used with any automation that produces the same structured schema.

Structured-Log-Report-Generator.ps1 analyzes structured log files and generates consolidated HTML, CSV, and JSON reports. Its primary output is an interactive HTML dashboard that summarizes execution status, detects Live and Dry Run executions, extracts warning and failure context, and provides expandable troubleshooting details.

The primary design goal is to provide a single operational dashboard that allows administrators to determine the health of multiple automated jobs at a glance, highlighting only the scripts that require investigation. Instead of manually opening and reviewing individual log files, administrators can quickly identify successful runs, warnings, incomplete executions, and failures from a single report.

Because the report generator operates on a standardized structured log format rather than script-specific output, new automation can be integrated simply by producing compatible logs and adding the corresponding log folder to the configured search paths. This allows the same reporting framework to be reused across backup jobs, Hyper-V automation, maintenance scripts, and future operational workflows without modifying the reporting engine.

Dashboard Preview

The generated HTML dashboard provides an at-a-glance operational view of recent structured log activity.

Dashboard Overview

Interactive HTML dashboard showing:

  • Summary cards
  • Interactive filtering by Status, Execution Mode, and Node
  • Color-coded execution states
  • Expandable warning and failure details
  • Direct links to the originating log files

Log Details

Selecting View Details expands structured warning and failure context without requiring the original log file to be opened manually.

Dashboard Details

Related Projects

This project is part of a larger automation ecosystem built around a reusable structured logging standard.

  • NAS Backup Automation Framework – Produces the structured logs consumed by this report generator while automating scheduled backup, disaster recovery, and retention workflows.

The report generator is intentionally independent of the automation producing the logs. Any script or application that emits the documented structured log format can be integrated by adding its log folder to $RootLogFolders.

What It Produces

Each run creates a folder like:

\\Server\Share\Reports\2026-07-01_143000

Inside that folder:

Structured-Log-Report-Generator.log
NAS_Consolidated_Report.csv
NAS_Consolidated_Report.html
NAS_Consolidated_Report.json

The HTML file is the main non-technical dashboard. CSV and JSON are for filtering, automation, or later reporting.

Basic Setup

Edit the configuration section at the top of the script:

$RootLogFolders = @(
    '\\PrimaryNAS\Script_Logs',
    '\\SecondaryNAS\Script_Logs'
)

$ReportFolder = '\\Operations\Reports'
$LookBackDays = 7
$ExcludeFolders = @()
$ConsolidatedFileTypes = @('Csv', 'Html', 'Json')
$MutexName = 'Global\Structured_Log_Report_Generator'
$OpenReportsAfterGeneration = $true

Set $OpenReportsAfterGeneration to $true to automatically open the generated HTML dashboard when the script completes.

Running the Script

Run the script using your preferred method (PowerShell console, Task Scheduler, or another automation tool).

Normal run:

.\Structured-Log-Report-Generator.ps1

Troubleshooting run with verbose output:

.\Structured-Log-Report-Generator.ps1 -Verbose

Execution Modes

The report generator distinguishes between:

  • Live
  • DryRun

Completed Dry Run executions are intentionally reported as Warning so they remain visible in the dashboard while still indicating successful execution.

Report Statuses

Status Meaning
Success Live execution completed successfully and a RUN_COMPLETE success marker was found.
Warning Warning markers were found, or the log represents a completed Dry Run execution.
Failed Failure or error markers were found.
Incomplete No successful RUN_COMPLETE marker was found.
Empty Log contains no records.
Unreadable The report generator could not read the log file due to insufficient permissions, a file lock, or another filesystem error.
Unknown No recognized status markers were found.

Structured Log Format

The report generator expects logs that follow a consistent, pipe-delimited structured format. It was originally designed to consume logs produced by the NAS Backup Automation Framework but can be used with any automation that emits the same schema.

Timestamp | RunId | Level | System | Service | Node | Action | Target | Metric | Result | Message

Example:

2026-06-19T18:41:50Z | 20260619T184150Z-20900 | INFO | NAS-COPY | WeeklyBackup | PrimaryNAS | COPY | FileServer01 | 0 | SUCCESS | copied
2026-06-19T18:41:51Z | 20260619T184150Z-20900 | WARN | NAS-COPY | WeeklyBackup | PrimaryNAS | COPY | AppServer01 | 1 | WARNING | destination contained additional files
2026-06-19T18:41:52Z | 20260619T184150Z-20900 | INFO | NAS-COPY | WeeklyBackup | PrimaryNAS | RUN_COMPLETE | script | 00:00:02 | SUCCESS | finished

The report generator analyzes these structured records to determine:

  • Execution Status (Success, Warning, Failed, Incomplete, Empty, Unreadable, or Unknown)
  • Execution Mode (Live or DryRun)
  • Completion State
  • Node
  • Warning Context
  • Failure Context

Status detection relies on structured values such as:

  • RUN_COMPLETE
  • SUCCESS
  • WARNING
  • ERROR
  • FAIL
  • EXECUTION_MODE=DRY_RUN

Any automation capable of producing this structured format can be integrated simply by adding its log folder to $RootLogFolders. No changes to the report generator are required.

Recommended Scheduled Task Usage

Run from a service account that has:

  • Read access to all $RootLogFolders
  • Write access to $ReportFolder
  • Permission to create folders and files under $ReportFolder

The script uses a named mutex to prevent overlapping local runs.

A common deployment pattern is to schedule the report generator to run shortly before routine operational reviews so the dashboard reflects the latest execution status of all monitored automation.

Notes

  • Only logs modified within $LookBackDays are included.
  • Only immediate child folders under each root are searched.
  • Reports are sorted by Status, Node, and Last Modified time.
  • HTML reports include interactive filtering by Status, Execution Mode, and Node.
  • Warning and failure rows include surrounding context lines.
  • All files from a single run are grouped in one timestamped folder.

About

Interactive PowerShell dashboard for analyzing structured log files with HTML, CSV, and JSON reporting.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages