The `splunk-logging` package provides a straightforward JavaScript interface for Node.js applications to send log data to Splunk Enterprise or Splunk Cloud via the HTTP Event Collector (HEC). The current stable version is 0.11.1, with releases occurring periodically to address dependencies and minor enhancements rather than a fixed cadence. This library simplifies the process of sending events by handling connection details, batching, and retries automatically. Key features include configurable batching settings (interval, maximum count, and maximum size), support for custom event formatting, and options for SSL certificate validation. While primarily community-supported, it is an official Splunk project designed for seamless integration with Splunk HEC endpoints, making it a robust choice for Node.js-based logging into the Splunk ecosystem.
npm install splunk-loggingVerified import paths — ran on the pinned version, not inferred.
Demonstrates configuring a Splunk logger with environment variables for token and URL, then sending a structured JSON payload to the HTTP Event Collector, and logging the Splunk response.
To enable SSL validation, set `Logger.requestOptions.strictSSL = true` immediately after initializing your SplunkLogger instance. Ensure your Node.js environment trusts the certificate authority for your Splunk instance.
Review your logger configuration, especially custom `requestOptions`, if upgrading from versions prior to 0.11.0. Thoroughly test network interactions to ensure continued compatibility.
Refer to the official project's GitHub page for the latest tested Node.js versions. If encountering network-related issues, try testing with the Node.js versions explicitly stated as supported.
Either disable SSL validation (`Logger.requestOptions.strictSSL = false` - *not recommended for production*) or ensure that the Splunk HEC endpoint's SSL certificate chain is valid and trusted by your Node.js environment. You might need to add custom CA certificates to your system's trust store or configure Node.js to use them.
Verify that the `url` configuration in your `SplunkLogger` instance is correct, ensure the Splunk HEC service is running and configured to listen on the specified port, and check network connectivity and firewall rules between your application server and the Splunk host.
Double-check the HEC token in your `Logger` configuration against the token configured in your Splunk Enterprise or Splunk Cloud instance. Ensure the token is enabled and has the necessary permissions to receive events.
No dependency data recorded yet.