A single-file Java application that monitors WebSphere configuration changes by processing repository checkpoints and generating audit logs.
- Scans checkpoint directories for Delta-* folders
- Tracks processed checkpoints to avoid reprocessing
- Extracts checkpoints using wsadmin.sh
- Compares before/after configurations
- Generates detailed audit logs with user information and timestamps
- Runs on a scheduled interval
- All configuration via properties file
- Java 8 or higher
- WebSphere Application Server with wsadmin.sh
- Access to checkpoint directory
- Valid WebSphere admin credentials
javac WebSphereAuditMonitor.javaMake scripts executable (first time only):
chmod +x start-monitor.sh stop-monitor.sh status-monitor.shStart the monitor in background:
./start-monitor.shOr with custom config file:
./start-monitor.sh /path/to/config.propertiesCheck status:
./status-monitor.shStop the monitor:
./stop-monitor.shView live logs:
tail -f monitor.logFirst run will create a default configuration file:
java WebSphereAuditMonitorOr specify a custom config file:
java WebSphereAuditMonitor myconfig.propertiesRun in background manually:
nohup java WebSphereAuditMonitor > monitor.log 2>&1 &
echo $! > .monitor.pidEdit the generated config.properties file:
# Directory containing Delta-* checkpoint folders
checkpoint.directory=/dmgr/config/temp/download/cells/was90cell/repository/checkpoints
# Path to WebSphere wsadmin.sh directory
wsadmin.path=/opt/IBM/WebSphere/AppServer/bin
# Output audit log file path
audit.log.path=./audit.log
# Schedule interval in minutes
schedule.interval.minutes=60
# File to track last processed timestamp
last.processed.timestamp.file=.last_processed_timestamp
# Log rolling configuration
audit.log.max.size.mb=5 # Maximum log file size before rolling (in MB)
audit.log.max.files=10 # Maximum number of rolled log files to keep
audit.log.archive.dir=./archived_logs # Directory for archived log filesNote: The monitor uses wsadmin with -conntype NONE (offline mode) to extract checkpoints without requiring an active WebSphere connection.
The audit log automatically rolls when it reaches the configured size limit:
How it works:
- When
audit.logreaches the size limit (default: 5MB), it's renamed with a timestamp- Example:
audit.log.20260415-143022
- Example:
- A new
audit.logfile is created for new entries - When the number of rolled files exceeds the limit (default: 10):
- Oldest log files are moved to an archive folder
- Archive folder is named with timestamp:
audit_logs_20260415-143022 - Archive folder is zipped:
audit_logs_20260415-143022.zip - Original files are deleted after zipping
- All history is preserved in timestamped zip files in the
archived_logsdirectory
Benefits:
- Prevents audit.log from growing indefinitely
- Maintains complete history (nothing is deleted)
- Automatic archiving and compression
- Easy to manage and review old logs
After configuration, run the program again:
java WebSphereAuditMonitorOr with custom config file:
java WebSphereAuditMonitor myconfig.propertiesThe program will:
- Run immediately on startup
- Continue running and check for new checkpoints every N minutes (configured interval)
- Process only new Delta directories since last run
- Generate audit logs showing all configuration changes
- Scan: Scans the checkpoint directory for
Delta-<timestamp>folders - Filter: Identifies new checkpoints since last run (tracked in
.last_processed_timestamp) - Extract: For each new checkpoint, executes wsadmin.sh to extract it to a zip file
- Unzip: Extracts the zip file to access
before/,after/folders anduser.id - Compare: Compares files between before and after directories
- Log: Generates audit log entries with:
- Timestamp of change
- User who made the change
- File path
- Change type (ADDED/MODIFIED/DELETED)
- Detailed line-by-line differences
- Track: Updates last processed timestamp for next run
================================================================================
Audit Log Entry - 2025-12-14 15:25:30
================================================================================
Timestamp: 2025-12-14 15:20:15
User: wasadmin
Cell: cell01
File: cells/cell01/applications/app.xml
Change Type: MODIFIED
Changes:
Line 15 modified:
Before: <property name="timeout" value="30"/>
After: <property name="timeout" value="60"/>
--------------------------------------------------------------------------------
Timestamp: 2025-12-14 15:21:45
User: wasadmin
Cell: cell01
File: cells/cell01/security/security.xml
Change Type: ADDED
Changes:
File created
--------------------------------------------------------------------------------
Three shell scripts are provided for easy management:
start-monitor.sh - Start the monitor in background
./start-monitor.sh admin mypassword
./start-monitor.sh admin mypassword /path/to/config.propertiesstop-monitor.sh - Stop the running monitor
./stop-monitor.shstatus-monitor.sh - Check if monitor is running
./status-monitor.shThe scripts automatically:
- Compile the Java file if needed
- Check if already running (prevents duplicates)
- Save PID for easy management
- Redirect output to monitor.log
- Handle graceful shutdown
nohup java WebSphereAuditMonitor admin mypassword > monitor.log 2>&1 &
echo $! > .monitor.pidTo stop:
kill $(cat .monitor.pid)- Check that config.properties exists and is properly formatted
- Verify checkpoint.directory path exists and is accessible
- Verify wsadmin.path is correct
- Verify checkpoint.directory path is correct
- Check that Delta-* directories exist
config.properties- Configuration file (created on first run).last_processed_timestamp- Tracks last processed checkpoint timestamp.monitor.pid- Process ID of running monitor (when using scripts)monitor.log- Console output and errors (when running in background)audit.log- Audit log with all configuration changesDelta-*.zip- Temporary checkpoint zip files (automatically deleted after processing)
Three shell scripts are included for easy process management:
-
start-monitor.sh - Starts the monitor in background
- Auto-compiles if needed
- Prevents duplicate instances
- Saves PID for management
- Logs to monitor.log
-
stop-monitor.sh - Stops the running monitor
- Graceful shutdown with fallback to force kill
- Cleans up PID file
-
status-monitor.sh - Shows monitor status
- Displays PID, CPU, memory usage
- Shows last 10 log lines
- The program runs continuously once started
- First run processes all existing checkpoints
- Subsequent runs only process new checkpoints
- All changes are logged in chronological order
- Binary files are skipped in comparison
- Large files may take time to process