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.
362 lines (361 loc) • 11.1 kB
TypeScript
/**
* 📦 File Compression Example
*
* This example demonstrates how to configure file compression for the logstack package.
* Compression helps reduce storage costs and improves upload performance for large files.
*/
import { Config } from '../types/config';
declare const basicCompressionConfig: Config;
declare const productionCompressionConfig: Config;
declare const developmentConfig: Config;
declare const compressionFormats: {
gzip: {
compression: {
enabled: boolean;
format: "gzip";
level: number;
fileSize: number;
};
dbUri: string;
uploadProvider: "local" | "s3" | "gcs" | "azure";
fileFormat?: "json" | "csv" | "txt";
retryAttempts?: number;
dailyCron?: string;
hourlyCron?: string;
timezone?: string;
retention?: {
database?: {
apiLogs?: number;
jobs?: number;
logs?: number;
autoCleanup?: boolean;
cleanupCron?: string;
};
storage?: {
files?: number;
autoCleanup?: boolean;
cleanupCron?: string;
s3Lifecycle?: {
transitionToIA?: number;
transitionToGlacier?: number;
transitionToDeepArchive?: number;
expiration?: number;
};
};
};
outputDirectory?: string;
folderStructure?: {
type?: "daily" | "monthly" | "yearly";
pattern?: string;
subFolders?: {
enabled?: boolean;
byHour?: boolean;
byStatus?: boolean;
custom?: string[];
};
naming?: {
dateFormat?: string;
includeTime?: boolean;
prefix?: string;
suffix?: string;
};
};
dataMasking?: {
enabled?: boolean;
maskingChar?: string;
preserveLength?: boolean;
showLastChars?: number;
customPatterns?: {
[key: string]: RegExp;
};
customFields?: string[];
exemptFields?: string[];
maskEmails?: boolean;
maskIPs?: boolean;
maskConnectionStrings?: boolean;
};
collections?: {
jobsCollectionName?: string;
logsCollectionName?: string;
apiLogsCollectionName?: string;
};
apiLogs?: {
existingCollection?: {
name: string;
timestampField: string;
requiredFields?: {
method?: string;
path?: string;
client_ip?: string;
user_id?: string;
requestBody?: string;
responseStatus?: string;
responseBody?: string;
requestHeaders?: string;
responseHeaders?: string;
};
};
createNew?: {
collectionName?: string;
enableMiddleware?: boolean;
autoFields?: boolean;
};
};
s3?: {
accessKeyId: string;
secretAccessKey: string;
region: string;
bucket: string;
endpoint?: string;
};
gcs?: {
projectId: string;
keyFilename?: string;
credentials?: any;
bucket: string;
};
azure?: {
connectionString: string;
containerName: string;
};
logging?: {
level: "debug" | "info" | "warn" | "error";
enableConsole?: boolean;
enableFile?: boolean;
logFilePath?: string;
};
};
brotli: {
compression: {
enabled: boolean;
format: "brotli";
level: number;
fileSize: number;
};
dbUri: string;
uploadProvider: "local" | "s3" | "gcs" | "azure";
fileFormat?: "json" | "csv" | "txt";
retryAttempts?: number;
dailyCron?: string;
hourlyCron?: string;
timezone?: string;
retention?: {
database?: {
apiLogs?: number;
jobs?: number;
logs?: number;
autoCleanup?: boolean;
cleanupCron?: string;
};
storage?: {
files?: number;
autoCleanup?: boolean;
cleanupCron?: string;
s3Lifecycle?: {
transitionToIA?: number;
transitionToGlacier?: number;
transitionToDeepArchive?: number;
expiration?: number;
};
};
};
outputDirectory?: string;
folderStructure?: {
type?: "daily" | "monthly" | "yearly";
pattern?: string;
subFolders?: {
enabled?: boolean;
byHour?: boolean;
byStatus?: boolean;
custom?: string[];
};
naming?: {
dateFormat?: string;
includeTime?: boolean;
prefix?: string;
suffix?: string;
};
};
dataMasking?: {
enabled?: boolean;
maskingChar?: string;
preserveLength?: boolean;
showLastChars?: number;
customPatterns?: {
[key: string]: RegExp;
};
customFields?: string[];
exemptFields?: string[];
maskEmails?: boolean;
maskIPs?: boolean;
maskConnectionStrings?: boolean;
};
collections?: {
jobsCollectionName?: string;
logsCollectionName?: string;
apiLogsCollectionName?: string;
};
apiLogs?: {
existingCollection?: {
name: string;
timestampField: string;
requiredFields?: {
method?: string;
path?: string;
client_ip?: string;
user_id?: string;
requestBody?: string;
responseStatus?: string;
responseBody?: string;
requestHeaders?: string;
responseHeaders?: string;
};
};
createNew?: {
collectionName?: string;
enableMiddleware?: boolean;
autoFields?: boolean;
};
};
s3?: {
accessKeyId: string;
secretAccessKey: string;
region: string;
bucket: string;
endpoint?: string;
};
gcs?: {
projectId: string;
keyFilename?: string;
credentials?: any;
bucket: string;
};
azure?: {
connectionString: string;
containerName: string;
};
logging?: {
level: "debug" | "info" | "warn" | "error";
enableConsole?: boolean;
enableFile?: boolean;
logFilePath?: string;
};
};
zip: {
compression: {
enabled: boolean;
format: "zip";
level: number;
fileSize: number;
};
dbUri: string;
uploadProvider: "local" | "s3" | "gcs" | "azure";
fileFormat?: "json" | "csv" | "txt";
retryAttempts?: number;
dailyCron?: string;
hourlyCron?: string;
timezone?: string;
retention?: {
database?: {
apiLogs?: number;
jobs?: number;
logs?: number;
autoCleanup?: boolean;
cleanupCron?: string;
};
storage?: {
files?: number;
autoCleanup?: boolean;
cleanupCron?: string;
s3Lifecycle?: {
transitionToIA?: number;
transitionToGlacier?: number;
transitionToDeepArchive?: number;
expiration?: number;
};
};
};
outputDirectory?: string;
folderStructure?: {
type?: "daily" | "monthly" | "yearly";
pattern?: string;
subFolders?: {
enabled?: boolean;
byHour?: boolean;
byStatus?: boolean;
custom?: string[];
};
naming?: {
dateFormat?: string;
includeTime?: boolean;
prefix?: string;
suffix?: string;
};
};
dataMasking?: {
enabled?: boolean;
maskingChar?: string;
preserveLength?: boolean;
showLastChars?: number;
customPatterns?: {
[key: string]: RegExp;
};
customFields?: string[];
exemptFields?: string[];
maskEmails?: boolean;
maskIPs?: boolean;
maskConnectionStrings?: boolean;
};
collections?: {
jobsCollectionName?: string;
logsCollectionName?: string;
apiLogsCollectionName?: string;
};
apiLogs?: {
existingCollection?: {
name: string;
timestampField: string;
requiredFields?: {
method?: string;
path?: string;
client_ip?: string;
user_id?: string;
requestBody?: string;
responseStatus?: string;
responseBody?: string;
requestHeaders?: string;
responseHeaders?: string;
};
};
createNew?: {
collectionName?: string;
enableMiddleware?: boolean;
autoFields?: boolean;
};
};
s3?: {
accessKeyId: string;
secretAccessKey: string;
region: string;
bucket: string;
endpoint?: string;
};
gcs?: {
projectId: string;
keyFilename?: string;
credentials?: any;
bucket: string;
};
azure?: {
connectionString: string;
containerName: string;
};
logging?: {
level: "debug" | "info" | "warn" | "error";
enableConsole?: boolean;
enableFile?: boolean;
logFilePath?: string;
};
};
};
export { basicCompressionConfig, productionCompressionConfig, developmentConfig, compressionFormats };