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.sh admin mypasswordCheck status:
./status-monitor.shStop the monitor:
./stop-monitor.shView live logs:
tail -f monitor.logFirst run will create a default configuration file (username and password are required):
java WebSphereAuditMonitor admin mypasswordOr specify a custom config file:
java WebSphereAuditMonitor admin mypassword myconfig.propertiesRun in background manually:
nohup java WebSphereAuditMonitor admin mypassword > monitor.log 2>&1 &
echo $! > .monitor.pidNote: Username and password are passed as command-line arguments for security (not stored in config file).
Edit 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
# WebSphere connection parameters
wsadmin.conntype=SOAP
wsadmin.host=localhost
wsadmin.port=8879
# 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_timestampConnection Type Options:
SOAP- SOAP connector (default, most common)RMI- RMI connectorIPC- Local IPC connectorNONE- No connector (local mode)
Common Ports:
- SOAP: 8879 (dmgr)
- RMI: 2809 (dmgr)
After configuration, run the program again with your credentials:
java WebSphereAuditMonitor admin mypasswordOr with custom config file:
java WebSphereAuditMonitor admin mypassword 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
File: config/cells/cell01/applications/app.xml
Change Type: MODIFIED
Changes:
Line 15 changed:
Before: <property name="timeout" value="30"/>
After: <property name="timeout" value="60"/>
--------------------------------------------------------------------------------
Timestamp: 2025-12-14 15:21:45
User: wasadmin
File: config/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)screen -dmS wsaudit java WebSphereAuditMonitor admin mypassword
# To reattach: screen -r wsaudit
# To detach: Ctrl+A then DCreate /etc/systemd/system/wsaudit.service:
[Unit]
Description=WebSphere Audit Monitor
After=network.target
[Service]
Type=simple
User=wasadmin
WorkingDirectory=/opt/wsaudit
ExecStart=/usr/bin/java WebSphereAuditMonitor admin mypassword
Restart=always
Environment="WAS_USER=admin"
Environment="WAS_PASS=mypassword"
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl daemon-reload
sudo systemctl enable wsaudit
sudo systemctl start wsaudit- Ensure you provided username and password as arguments
- Check that config.properties exists and is properly formatted
- Verify checkpoint.directory path exists and is accessible
- Verify wsadmin.path is correct
- Check username and password provided as arguments are valid
- Ensure WebSphere server is running
- Check wsadmin.sh has execute permissions
- Verify checkpoint.directory path is correct
- Check that Delta-* directories exist
- Ensure proper read permissions on the directory
- Check write permissions for audit.log.path
- Verify there are actual differences between before/after files
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
This is a utility tool for WebSphere administration and auditing purposes.