{"id":44264720,"url":"https://github.com/leotrinh/sap_btp_cloud_logging_client","last_synced_at":"2026-02-10T18:10:50.182Z","repository":{"id":305805228,"uuid":"1023753261","full_name":"leotrinh/sap_btp_cloud_logging_client","owner":"leotrinh","description":"SAP BTP Cloud Logging Client","archived":false,"fork":false,"pushed_at":"2025-09-14T16:11:09.000Z","size":368,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-14T16:28:38.819Z","etag":null,"topics":["cloudlogging","sap","sapbtp"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sap-btp-cloud-logging-client","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leotrinh.png","metadata":{"files":{"readme":"README.MD","changelog":"ChangeLogs.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-21T16:32:31.000Z","updated_at":"2025-09-14T16:11:13.000Z","dependencies_parsed_at":"2025-07-22T05:38:27.836Z","dependency_job_id":"0ef29080-d5f8-44d6-ab7f-63e52ab8a759","html_url":"https://github.com/leotrinh/sap_btp_cloud_logging_client","commit_stats":null,"previous_names":["leotrinh/sap_btp_cloud_logging_client"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/leotrinh/sap_btp_cloud_logging_client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leotrinh%2Fsap_btp_cloud_logging_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leotrinh%2Fsap_btp_cloud_logging_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leotrinh%2Fsap_btp_cloud_logging_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leotrinh%2Fsap_btp_cloud_logging_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leotrinh","download_url":"https://codeload.github.com/leotrinh/sap_btp_cloud_logging_client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leotrinh%2Fsap_btp_cloud_logging_client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29310135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T17:48:59.043Z","status":"ssl_error","status_checked_at":"2026-02-10T17:45:37.240Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudlogging","sap","sapbtp"],"created_at":"2026-02-10T18:10:49.510Z","updated_at":"2026-02-10T18:10:50.175Z","avatar_url":"https://github.com/leotrinh.png","language":"JavaScript","readme":"# SAP BTP Cloud Logging Client\n\n[![npm version](https://img.shields.io/npm/v/sap-btp-cloud-logging-client.svg)](https://www.npmjs.com/package/sap-btp-cloud-logging-client) [![npm downloads](https://img.shields.io/npm/dm/sap-btp-cloud-logging-client.svg)](https://www.npmjs.com/package/sap-btp-cloud-logging-client)\n\nA Package support using cloud logging multiple-sub accounts with 1 Cloud Logging instance\nExample: Your System Landscape with 3 global account (2 CPEA, 1 PAYG)\n```\n├── Global CPEA Subcribe\n│   ├── Sub Account A Subcribed Cloud Logging\n│   ├── Sub Account B using Cloud Logging via sap-btp-cloud-logging-client\n├── Global CPEA using/\n│   └── Sub Account C using Cloud Logging via sap-btp-cloud-logging-client\n├── Global PAYG/\n│   └── Sub Account D using Cloud Logging via sap-btp-cloud-logging-client\n```\n\n## Documentation\n- [**Architecture \u0026 Design**](docs/Architecture.md) - Internal components and multi-subaccount patterns.\n- [**Detailed Usage Guide**](docs/Usage.md) - Configuration references and advanced features.\n- [**Release Notes**](docs/Release.md) - Release process.\n\n## Project Structure\n```\nsap-btp-cloud-logging-client/\n├── package.json\n├── README.md\n├── LICENSE\n├── index.js\n├── lib/\n│   ├── CloudLoggingService.js\n│   ├── ConfigManager.js\n│   ├── LogFormatter.js\n│   ├── Transport.js\n│   ├── Middleware.js\n│   ├── WinstonTransport.js\n│   └── JSONUtils.js\n├── types/\n│   └── index.d.ts\n├── examples/\n│   ├── basic-usage.js\n│   ├── express-middleware.js\n│   ├── advanced-usage.js\n│   ├── winston-integration.js\n│   ├── BTPCloudLogger.ts\n│   └── utils/\n│       ├── LogUtils.ts\n│       └── LogUtils.js\n├── docs/\n│   ├── Architecture.md\n│   ├── Usage.md\n│   └── Release.md\n└── test/\n    └── CloudLoggingService.test.js\n```\n\n## Usage\n\n### Install package\n```\nnpm install sap-btp-cloud-logging-client\n```\n### Env config\nAll required config bellow can get from Service: Cloud Logging instance Service Keys\n- v1.0.0 it's support only this way\n```\n# Required\nBTP_LOGGING_INGEST_ENDPOINT=https://ingest-sf-xxx.cls-16.cloud.logs.services.eu10.hana.ondemand.com\nBTP_LOGGING_USERNAME=your-ignest-username\nBTP_LOGGING_PASSWORD=your-ingest-password\n\n# Optional\nBTP_SUBACCOUNT_ID=subaccount-id #to determine the logs source\nBTP_APPLICATION_NAME=your-app-name #it's based on application\nBTP_LOG_LEVEL=INFO # Optional: DEBUG, INFO, WARN, ERROR, FATAL (default: DEBUG)\nBTP_LOGGING_MAX_RETRIES=3\nBTP_LOGGING_TIMEOUT=5000\n```\n#### Log Level Filtering\n- You can control the verbosity of logs using `BTP_LOG_LEVEL` or `logLevel` in config.\n- Levels: `DEBUG` \u003c `INFO` \u003c `WARN` \u003c `ERROR` \u003c `FATAL`\n- Example: If `BTP_LOG_LEVEL=WARN`, only `WARN`, `ERROR`, and `FATAL` logs will be sent.\n\n- from v1.0.1 support new way using json from service key JSON of Cloud Logging (still auth by basic not mtls way -\u003e then you can remove ```server-ca,ingest-mtls-key,ingest-mtls-cert,client-ca``` we no need it any more just add this for lazy set multiple env prop)\n  \nGet it from ```SubAccount (Subcribtion Cloug Logging) -\u003e Instance Cloud Logging -\u003e Service Keys (if not exist create new one)```\nBTP_LOGGING_SRV_KEY_CRED = {copy all json from Cloud Logging Service Key}\n\nExample: ```BTP_LOGGING_SRV_KEY_CRED ='\u003cjson content copy from service key\u003e'```\n\n```\nBTP_LOGGING_SRV_KEY_CRED ='{\n    \"client-ca\": \"\u003csensitive\u003e\",\n    \"dashboards-endpoint\": \"dashboards-sf-61111e58-2a9a-4790-9baf-efe56ec2c871.cls-16.cloud.logs.services.eu10.hana.ondemand.com\",\n    \"dashboards-password\": \"\u003csensitive\u003e\",\n    \"dashboards-username\": \"\u003csensitive\u003e\",\n    \"ingest-endpoint\": \"ingest-sf-61111e58-2a9a-4790-9baf-efe56ec2c871.cls-16.cloud.logs.services.eu10.hana.ondemand.com\",\n    \"ingest-mtls-cert\": \"\",\n    \"ingest-mtls-endpoint\": \"ingest-mtls-sf-61111e58-2a9a-4790-9baf-efe56ec2c871.cls-16.cloud.logs.services.eu10.hana.ondemand.com\",\n    \"ingest-mtls-key\": \"\",\n    \"ingest-password\": \"\u003csensitive\u003e\",\n    \"ingest-username\": \"vMSeXiYcYF\",\n\"server-ca\":\"\u003csensitive\u003e\"\n}'\n```\n### Auth \u0026 post log\nWe'll use username, password from service key for ```basic auth``` for ```mtls``` way seem the key valid max only ```180 days``` we've to create a feature auto create/get new key...etc it complex even we've env ```BTP_LOGGING_SRV_AUTH_TYPE='basic';//allow: basic,mtls``` but not recommend using ```mtls``` this time\n![ignest expire 180 days](docs/static/ignets-mtls-180-days.png)\n\n### Instance Specify Config\n\n```\nconst logger = createLogger({\n  ingestEndpoint: 'https://ingest-sf-xxx.cls-16.cloud.logs.services.eu10.hana.ondemand.com',\n  username: 'your-username',\n  password: 'your-password',\n  applicationName: 'my-app',\n  subaccountId: 'subaccount-b',\n  environment: 'production'\n});\n```\n\n### Implementation\n#### Basic\n- Javascript\n```\nconst { createLogger } = require('sap-btp-cloud-logging-client');\n\nconst logger = createLogger();\n\nlogger.info('Hello from BTP Cloud Logging!');\n```\n- Typescript\n```\nimport { createLogger, middleware as loggingMiddleware } from 'sap-btp-cloud-logging-client';\nconst logger = createLogger();\nlogger.info('Hello from BTP Cloud Logging!');\n```\nor can create a standard common class (Singleton pattern) for using:\n\u003e **Check full example code at:** [examples/utils/LogUtils.ts](examples/utils/LogUtils.ts)\n\n```typescript\nimport { LogUtils }  from './utils/LogUtils';\n\n// Get instance (Singleton)\nconst logger = LogUtils.getInstance();\n\n// Usage\nlogger.info('System initialized');\n\n// API Logging\nlogger.apiInfo('User login', {\n    source: 'AuthService',\n    userId: 'user-123',\n    statusCode: 200\n});\n\n// Scheduler Logging\nlogger.schedulerInfo('Daily sync started', {\n    jobName: 'SyncJob',\n    jobId: 'job-001'\n});\n```\n### Middleware Configuration\nYou can configure the Express middleware to exclude paths or toggle logging:\n\n```javascript\nconst { createLogger, middleware } = require('sap-btp-cloud-logging-client');\nconst app = require('express')();\nconst logger = createLogger();\n\napp.use(middleware(logger, {\n  logRequests: true,      // Log incoming requests (default: true)\n  logResponses: true,     // Log responses (default: true)\n  excludePaths: ['/health', '/metrics', '/readiness'] // Skip logging for these paths\n}));\n```\n\n#### Add metadata dynamic property\n```\nconst sampleMetadata = {\n        source:\"S4\",\n        source_system:\"S4H_DEMO\",\n        payload: {\n            user:\"leo\"\n        }\n    };\n    logger.info(`New Supplier Created`,sampleMetadata);\n```\nResult\n![using metadata dynamic property](docs/static/metadata-dynamic-property.png)\n#### Logs Batch \n\n```\nasync function batchLogging() {\n  const entries = [\n    { level: 'INFO', message: 'Batch entry 1', metadata: { batch: 1 } },\n    { level: 'INFO', message: 'Batch entry 2', metadata: { batch: 2 } },\n    { level: 'WARN', message: 'Batch entry 3', metadata: { batch: 3 } }\n  ];\n\n  await logger.logBatch(entries);\n}\n```\n### Dashboard \u0026 Discovery Logs\n#### Cloud Logging Open Search Dashboard\n- The url/ credential to access Dashboard inside Service Key you will see\n\n```\n\"dashboards-endpoint\": \"dashboards-sf-61111e58-2a9a-4790-9baf-efe56ec2c871.cls-16.cloud.logs.services.eu10.hana.ondemand.com\",\n\"dashboards-password\": \"\u003csensitive\u003e\",\n\"dashboards-username\": \"\u003csensitive\u003e\",\n```\nUsing browser to visit url: ```dashboards-endpoint``` and cred (username, password) above\n\n- Discovery Logs: from the dashboard click to Discovery menu on the left side\n![Discovery Logs](docs/static/discovery-log.png)\nThen you should filter by ```logs-json-*```\n![logs-json-*](docs/static/discovery-logs-json.png)\nhere you can filter data by sub account, application...etc\n\n## Contributors\nWe want to make contributing to this project as easy and transparent as possible. So, just simple do the change then create PR","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleotrinh%2Fsap_btp_cloud_logging_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleotrinh%2Fsap_btp_cloud_logging_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleotrinh%2Fsap_btp_cloud_logging_client/lists"}