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
Markdown
# š 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();
```