-
Notifications
You must be signed in to change notification settings - Fork 0
Add sample prompt for creating tailpipe table #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
--- | ||
title: Using AI | ||
sidebar_label: Using AI | ||
--- | ||
|
||
# Using AI | ||
|
||
Creating new tables for Tailpipe plugins with AI tools and IDEs works remarkably well. At Turbot, we develop plugin tables frequently and use AI for almost every new table we create. We've experimented with various approaches, including detailed prompt engineering, explicit guidelines, IDE rules and instructions, and complex workflows, but found that AI typically produces excellent results even without heavy guidance. | ||
|
||
The key to this success is working within existing plugin repositories and opening the entire repository as a folder or project in your IDE. This gives AI tools access to existing table implementations, documentation examples, code patterns, and naming conventions to generate consistent, high-quality results without extensive prompting. | ||
|
||
If you're looking to use AI to query Tailpipe rather than develop new tables, you can use the [Tailpipe MCP server](https://github.com/turbot/tailpipe-mcp), which provides powerful tools for AI agents to inspect tables and run queries. | ||
|
||
## Getting Started | ||
|
||
While AI often works well with simple requests like "Create a table for [log_type]", here are some prompts we use at Turbot that you may find helpful as starting points. | ||
|
||
### Prerequisites | ||
|
||
1. Open the plugin repository in your IDE (Cursor, VS Code, Windsurf, etc.) to give AI tools access to all existing code and documentation. | ||
2. Ensure you have Tailpipe installed (`brew install turbot/tap/tailpipe` for MacOS or the installation script for Linux/WSL). | ||
3. Set up access credentials for the cloud provider (e.g., AWS credentials). | ||
4. Configure test log sources (e.g., S3 buckets with sample logs, CloudWatch Log Groups). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For artifact based sources, it's actually better to have some samples locally when developing, doesn't require a complex partition config like S3 bucket and also allows the AI tool to be able to |
||
5. Configure the [Tailpipe MCP server](https://github.com/turbot/tailpipe-mcp) which allows the agent to inspect tables and run queries. | ||
|
||
### Create Table | ||
|
||
First, create the new table and its documentation, using existing tables and docs as reference. | ||
|
||
```md | ||
Your goal is to create a new Tailpipe table and documentation for <log_type>. | ||
|
||
1. Review existing tables and their documentation in the plugin to understand: | ||
- Table structure patterns and naming conventions | ||
- Source configurations (S3, CloudWatch, etc.) | ||
- Standard field enrichment patterns | ||
- Column structures and data types | ||
|
||
2. Create the table implementation with: | ||
- Proper source metadata configuration | ||
- Row enrichment logic for standard and log-specific fields | ||
- Extractor implementation for parsing logs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
- Registration in the plugin | ||
|
||
3. Create documentation at `docs/tables/<table_name>.md` including: | ||
- Table overview and description | ||
- Configuration examples for each source type | ||
- Example queries with expected results | ||
- Complete schema reference | ||
``` | ||
|
||
### Build Plugin | ||
|
||
Next, build the plugin with your changes and verify your new table is properly registered. | ||
|
||
```md | ||
Your goal is to build the plugin and verify that your new <log_type> table is properly registered and functional. | ||
|
||
1. Build the plugin using `make` command. | ||
|
||
2. Verify the table is registered using `tailpipe plugin list`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
3. Check the table schema and structure using the Tailpipe MCP server | ||
|
||
4. Test basic querying functionality with `tailpipe query "select * from aws_<log_type> limit 1"`. | ||
Comment on lines
+63
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A query will not work until there has been a collection of a partition though? |
||
``` | ||
|
||
### Configure Test Sources | ||
|
||
To test the table's functionality, you'll need log sources to query. Configure appropriate sources based on your table's requirements. | ||
|
||
```md | ||
Your goal is to configure log sources for <log_type> to validate your table implementation. | ||
|
||
1. Configure appropriate source in ~/.tailpipe/config/aws.tpc: | ||
|
||
For S3 logs: | ||
partition "aws_<log_type>" "s3_logs" { | ||
source "aws_s3_bucket" { | ||
connection = connection.aws.test_account | ||
bucket = "test-logs-bucket" | ||
} | ||
} | ||
|
||
For CloudWatch logs: | ||
partition "aws_<log_type>" "cloudwatch_logs" { | ||
source "aws_cloudwatch_log_group" { | ||
connection = connection.aws.test_account | ||
log_group_name = "/aws/my-log-group" | ||
} | ||
} | ||
|
||
2. Ensure test logs are available in your configured source with sufficient data variety to test all table columns and features. | ||
Comment on lines
+72
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how well this will work, how does the AI know where your logs are? |
||
``` | ||
|
||
### Validate Data Collection | ||
|
||
Next, collect and query the logs to test that the table implementation works correctly. | ||
|
||
```md | ||
Your goal is to thoroughly test your <log_type> table implementation by validating data collection and querying. | ||
|
||
1. Collect logs from your configured source using `tailpipe collect aws_<log_type>` command. | ||
|
||
2. Validate the implementation: | ||
- Execute `select * from aws_<log_type>` to verify all columns have correct data | ||
- Test each example query from the documentation | ||
- Verify field types and enrichment logic | ||
- Test filtering and aggregation capabilities | ||
|
||
3. Document your test results including: | ||
- Collection statistics | ||
- Query results | ||
- Any parsing or enrichment issues found | ||
``` | ||
|
||
### Cleanup Test Resources | ||
|
||
After testing is completed, clean up test resources and data. | ||
|
||
```md | ||
Your goal is to clean up all test resources created for <log_type> validation. | ||
|
||
1. Remove all test data from your configured sources: | ||
- Delete test log files from S3 buckets | ||
- Clean up test log streams from CloudWatch | ||
- Remove any other test artifacts created | ||
|
||
2. Verify that all test resources have been successfully removed using the same tools used to create them. | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth making
Linux
andWSL
links to the page containing the script if we're not going to provide it: