alb-log-parser is a utility library for Node.js designed to parse Application Load Balancer (ALB) access logs generated by AWS. It provides a function to convert raw ALB log strings into structured JavaScript objects, mapping all fields defined by AWS, including recent additions like `target_group_arn`, `trace_id`, and `classification`. The current stable version is 0.0.8, with the last publish date being July 11, 2021. As a fork of `elb-log-parser`, its release cadence is infrequent, primarily focused on adapting to changes in AWS ALB log formats and improving parsing robustness, such as correctly handling `-1` as a numeric value. It differentiates itself by offering comprehensive field support specifically for ALB logs, making it suitable for serverless architectures (e.g., AWS Lambda) that process logs from S3 buckets for analysis in systems like Elasticsearch.
npm install alb-log-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install `alb-log-parser` and use its primary `parse` function to convert a raw ALB access log string into a structured JavaScript object. It shows both installation and basic API usage with a sample log line.
Rely on specific patch versions (e.g., `~0.0.8` instead of `^0.0.8`) or thoroughly test updates before deploying to production environments.
Periodically review AWS documentation for ALB log format changes and verify library behavior against new log entries. Consider contributing upstream or migrating if official support or more active development becomes critical.
Update consumers of the parsed log data to expect numeric `-1` for relevant fields where `"-"` previously indicated absence or a non-numeric value. Review pipelines that perform strict type checking or rely on the previous string representation.
Use `const parse = require('alb-log-parser');` for CommonJS or `import parse from 'alb-log-parser';` for ESM to correctly import the default exported function.Switch to ESM import syntax: `import parse from 'alb-log-parser';` if your project is configured for ES Modules.
No dependency data recorded yet.