/api/logs endpoint receives error logs from vij-sdk or custom clients and stores them in MongoDB.
Request
The error message describing what went wrong.Example:
"TypeError: Cannot read property 'map' of undefined"The error name or type.Example:
"TypeError", "ReferenceError", "CustomError"Full stack trace of the error.Example:
Severity level of the error.Values:
"error", "warning", "info"Default: "error"ISO 8601 timestamp when the error occurred.Format:
YYYY-MM-DDTHH:mm:ss.sssZExample: "2024-01-01T12:34:56.789Z"Identifier for the application that generated the error.Example:
"my-frontend-app", "backend-api", "mobile-app"Environment where the error occurred.Example:
"production", "staging", "development"Custom metadata attached to the error.Example:
Environmental context (browser or Node.js information).Browser Context:Node.js Context:
Response
Indicates whether the log was successfully stored.
MongoDB ObjectId of the created log entry.
Fingerprint hash used for error grouping.
Example Request
Example Response
Error Responses
Validation Rules
Required Fields
Required Fields
All of these fields must be present:
messagenamestackseveritytimestampappIdenvironment
metadata(defaults to{})context(defaults to{})
Severity Values
Severity Values
severity must be one of:"error"- Critical errors"warning"- Non-critical issues"info"- Informational logs
Timestamp Format
Timestamp Format
timestamp must be a valid ISO 8601 string:- Format:
YYYY-MM-DDTHH:mm:ss.sssZ - Example:
2024-01-01T12:34:56.789Z - Must be in UTC (Z timezone)
String Length Limits
String Length Limits
message: Max 10,000 charactersname: Max 500 charactersstack: Max 50,000 charactersappId: Max 100 charactersenvironment: Max 50 characters
Rate Limiting
VIJ Admin does not enforce rate limiting by default. However, you should implement rate limiting in production to prevent abuse.
- 1,000 requests per minute per IP
- 10,000 requests per hour per appId
CORS Configuration
VIJ Admin allows all origins by default for the/api/logs endpoint.
Default CORS headers:
Processing Pipeline
When a log is received, VIJ processes it through these steps:- Validation - Check required fields and formats
- Fingerprinting - Generate error group fingerprint
- Storage - Insert into MongoDB
logscollection - Indexing - Update MongoDB indexes
- Grouping - Update error group counters
- Response - Return success with log ID
Batch Logging
Send multiple logs in a single request:Security Considerations
No authentication by default
No authentication by default
VIJ Admin does not require authentication for the
/api/logs endpoint by default.Add authentication:Sanitize sensitive data
Sanitize sensitive data
Never log sensitive information:
- Passwords
- API keys
- Credit card numbers
- Social security numbers
- Personal identification
Validate input size
Validate input size
Prevent large payloads from overwhelming the server:
Troubleshooting
400 Bad Request
400 Bad Request
Common causes:
- Missing required fields
- Invalid severity value
- Invalid timestamp format
- Malformed JSON
413 Payload Too Large
413 Payload Too Large
Cause: Request body exceeds size limitSolution:
- Reduce stack trace length
- Minimize metadata
- Use batch endpoint for multiple logs
500 Internal Server Error
500 Internal Server Error
Common causes:
- MongoDB connection failure
- Database write error
- Server configuration issue
CORS errors
CORS errors
Symptom: Browser blocks requestSolution: Ensure CORS headers allow your domain or use
* for all origins