npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cdk-athena-log

v0.0.14

Published

A CDK construct to create an Athena table for querying ALB logs.

Readme

Athena Log Constructs for AWS CDK

NPM version PyPI version View on Construct Hub

This AWS CDK library provides a collection of ready-to-use constructs to create AWS Glue tables for various AWS service logs, making them queryable with Amazon Athena.

This library simplifies the setup of schemas, SerDes, and partition settings, allowing you to focus on analyzing your data, not on boilerplate table definitions.


Available Constructs 🧰

This library currently supports the following log types:

  • Application Load Balancer (ALB) - Uses Partition Projection (maintenance-free).
  • AWS WAF - Uses Partition Projection for JSON logs (maintenance-free).
  • VPC Flow Logs - Requires MSCK REPAIR TABLE for partition updates.

Installation 📦

# pnpm
pnpm add cdk-athena-log

# npm
npm install cdk-athena-log

# yarn
yarn add cdk-athena-log

Usage 🚀

Import the specific construct you need and use it in your CDK stack.

For Application Load Balancer (ALB) Logs

This construct uses Partition Projection, so you don't need to manually update partitions.

import { AthenaTableForAlb } from 'cdk-athena-log';

new AthenaTableForAlb(this, 'AlbLogsAthenaTable', {
  logBucketName: 'my-alb-access-logs-bucket',
  databaseName: 'analytics_db',
  tableName: 'alb_access_logs',
  projectionStartDate: '2025/01/01',
});

For AWS WAF Logs

This construct also uses Partition Projection and is designed for JSON-formatted WAF logs.

import { AthenaTableForWaf } from 'cdk-athena-log';

new AthenaTableForWaf(this, 'WafLogsAthenaTable', {
  logBucketName: 'my-waf-access-logs-bucket',
  databaseName: 'analytics_db',
  tableName: 'waf_access_logs',
  projectionStartDate: '2025/01/01',
});

For VPC Flow Logs

⚠️ Important Note This table does not use partition projection. You must run MSCK REPAIR TABLE your_vpc_table_name; in the Athena query editor to discover new log partitions before you can query them.

import { AthenaTableForVpcFlowLog } from 'cdk-athena-log';

new AthenaTableForVpcFlowLog(this, 'VpcFlowLogsAthenaTable', {
  logBucketName: 'my-vpc-flow-logs-bucket',
  databaseName: 'analytics_db',
  tableName: 'vpc_flow_logs',
  logPrefix: 'flowLog', // Example prefix
});

API Reference 📖

AthenaTableForAlb

| Prop Name | Type | Required | Description | | --------------------- | -------- | -------- | ------------------------------------------------------------------------------ | | logBucketName | string | Yes | The name of the S3 bucket where your ALB logs are stored. | | databaseName | string | Yes | The name of the Glue database where the table will be created. | | tableName | string | Yes | The name of the table to be created in Athena. | | projectionStartDate | string | Yes | The start date for partition projection, in YYYY/MM/DD format. | | logPrefix | string | No | (Optional) The prefix within the S3 bucket where logs are located. |

AthenaTableForWaf

| Prop Name | Type | Required | Description | | --------------------- | -------- | -------- | ------------------------------------------------------------------------------ | | logBucketName | string | Yes | The name of the S3 bucket where your WAF logs are stored. | | databaseName | string | Yes | The name of the Glue database where the table will be created. | | tableName | string | Yes | The name of the table to be created in Athena. | | projectionStartDate | string | Yes | The start date for partition projection, in YYYY/MM/DD format. | | logPrefix | string | No | (Optional) The prefix within the S3 bucket where logs are located. |

AthenaTableForVpcFlowLog

| Prop Name | Type | Required | Description | | --------------- | -------- | -------- | ------------------------------------------------------------------------------ | | logBucketName | string | Yes | The name of the S3 bucket where your VPC Flow Logs are stored. | | databaseName | string | Yes | The name of the Glue database where the table will be created. | | tableName | string | Yes | The name of the table to be created in Athena. | | logPrefix | string | Yes | The prefix within the S3 bucket where logs are located (e.g., 'flowLog'). |


Contributing 🤝

Contributions are welcome! Please open an issue or submit a pull request.

License 📄

This project is licensed under the Apache-2.0 License.