UNPKG

logstack-zee

Version:

Complete Node.js logging solution with 6 integration methods, S3 bidirectional operations, advanced analytics, and multi-cloud storage support for enterprise-scale applications.

127 lines (92 loc) • 3.01 kB
# šŸš€ Complete Implementation Test Guide ## Quick Start 1. **Install dependencies:** ```bash npm install ``` 2. **Build the project:** ```bash npm run build ``` 3. **Set up environment variables:** ```bash cp .env.complete-test .env # Edit .env with your actual AWS credentials ``` 4. **Start MongoDB:** ```bash # Make sure MongoDB is running on localhost:27017 mongod ``` 5. **Run the complete test:** ```bash node examples/complete-implementation.js ``` ## Configuration Features This implementation includes: - āœ… **AWS S3 Integration**: Automatic upload with organized folder structure - āœ… **Daily Folder Structure**: `production-logs_2024-01-15/hour-14-15/success/` - āœ… **180 Days File Retention**: Automatic S3 cleanup after 180 days - āœ… **14 Days API Logs Retention**: MongoDB cleanup after 14 days - āœ… **No Compression**: Files stored without compression - āœ… **Password Masking**: Automatic password field masking - āœ… **Real API Logs**: Generates realistic test data with login requests ## Expected Output The test will check: 1. šŸ” Database connection 2. šŸ” AWS S3 configuration 3. šŸ” Configuration validation 4. šŸ” API log generation (with passwords) 5. šŸ” Logstack initialization 6. šŸ” Data masking functionality 7. šŸ” Folder structure creation 8. šŸ” Retention policies setup ## File Structure Created ``` S3 Bucket/ ā”œā”€ā”€ production-logs_2024-01-15/ │ ā”œā”€ā”€ hour-00-01/ │ │ ā”œā”€ā”€ success/ │ │ │ └── api_logs_2024-01-15_00-01.json │ │ └── failed/ │ │ └── api_logs_2024-01-15_00-01.json │ ā”œā”€ā”€ hour-14-15/ │ │ ā”œā”€ā”€ success/ │ │ └── failed/ │ └── hour-23-24/ ā”œā”€ā”€ production-logs_2024-01-16/ └── production-logs_2024-01-17/ ``` ## MongoDB Collections - `production_jobs`: Job scheduling and status - `production_logs`: Processed log entries - `production_api_logs`: Raw API log data (14-day retention) ## Troubleshooting **Database Connection Issues:** ```bash # Check if MongoDB is running mongo --eval "db.adminCommand('ismaster')" ``` **AWS Issues:** ```bash # Test AWS credentials aws s3 ls s3://your-bucket-name ``` **Missing Dependencies:** ```bash npm install mongoose aws-sdk ``` ## Manual Testing After running the test, you can manually verify: 1. **Check S3 bucket** for uploaded files 2. **Check MongoDB** for created collections 3. **Verify folder structure** matches the expected pattern 4. **Confirm password masking** in the uploaded files ## Production Deployment Once tests pass, you can use this configuration in production: ```javascript const { init, createDailyJobs } = require("logstack"); // Use the same config from complete-implementation.js await init(completeConfig); await createDailyJobs(); ```