Skip to content

feat(logs): add storage tier support for Flex logs#44

Merged
platinummonkey merged 1 commit into
DataDog:mainfrom
robhughadams:feat/logs-storage-tier-support
Feb 11, 2026
Merged

feat(logs): add storage tier support for Flex logs#44
platinummonkey merged 1 commit into
DataDog:mainfrom
robhughadams:feat/logs-storage-tier-support

Conversation

@robhughadams
Copy link
Copy Markdown
Contributor

@robhughadams robhughadams commented Feb 11, 2026

What does this PR do?

Adds --storage flag to all log search commands (search, list, query, aggregate) enabling users to query specific Datadog log storage tiers: indexes (standard), online-archives (long-term), and flex (cost-optimized).

Changes:

  • Added logsStorage flag variable in cmd/logs_simple.go:548
  • Implemented validateAndConvertStorageTier() helper function (cmd/logs_simple.go:685-705)
  • Added --storage flag to logs search, list, query, aggregate commands
  • Modified runLogsSearch(), runLogsList(), runLogsQuery(), runLogsAggregate() to validate and apply storage tier
  • Added comprehensive test coverage with 17 test cases in cmd/logs_simple_test.go
  • Updated docs/EXAMPLES.md with storage tier usage examples
  • Updated docs/COMMANDS.md with Flex logs example

Features:

  • Validates storage tier before API calls for fast failure
  • Case-insensitive input handling (FLEX, flex, Flex all work)
  • Whitespace trimming for user convenience
  • Helpful error messages showing valid options
  • Backward compatible: omitting --storage searches all tiers (default behavior)

Testing:

  • TestValidateAndConvertStorageTier: 9 test cases covering validation logic
  • TestRunLogsSearchWithStorageTier: 5 test cases for search command
  • TestRunLogsQueryWithStorageTier: 2 test cases for query command
  • TestRunLogsAggregateWithStorageTier: 1 test case for aggregate command
  • All tests pass with existing test suite
  • Full cmd package coverage maintained

Motivation

I wanted to be able to use the command line to search flex tier logs as that's not supported at the moment.

Checklist

  • The code change follows the project conventions (see CONTRIBUTING.md)
  • Tests have been added/updated (if applicable)
  • Documentation has been updated (if applicable)
  • All CI checks pass
  • Code coverage is maintained or improved

Related Issues

I haven't created an issue for this - let me know if you'd like that before getting the PR.

Adds --storage flag to all log search commands (search, list, query,
aggregate) enabling users to query specific Datadog log storage tiers:
indexes (standard), online-archives (long-term), and flex (cost-optimized).

Changes:
- Added logsStorage flag variable in cmd/logs_simple.go:548
- Implemented validateAndConvertStorageTier() helper function (cmd/logs_simple.go:685-705)
- Added --storage flag to logs search, list, query, aggregate commands
- Modified runLogsSearch(), runLogsList(), runLogsQuery(), runLogsAggregate() to validate and apply storage tier
- Added comprehensive test coverage with 17 test cases in cmd/logs_simple_test.go
- Updated docs/EXAMPLES.md with storage tier usage examples
- Updated docs/COMMANDS.md with Flex logs example

Features:
- Validates storage tier before API calls for fast failure
- Case-insensitive input handling (FLEX, flex, Flex all work)
- Whitespace trimming for user convenience
- Helpful error messages showing valid options
- Backward compatible: omitting --storage searches all tiers (default behavior)

Testing:
- TestValidateAndConvertStorageTier: 9 test cases covering validation logic
- TestRunLogsSearchWithStorageTier: 5 test cases for search command
- TestRunLogsQueryWithStorageTier: 2 test cases for query command
- TestRunLogsAggregateWithStorageTier: 1 test case for aggregate command
- All tests pass with existing test suite
- Full cmd package coverage maintained

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@robhughadams robhughadams marked this pull request as ready for review February 11, 2026 18:42
@robhughadams robhughadams requested a review from a team as a code owner February 11, 2026 18:42
@platinummonkey platinummonkey added the enhancement New feature or request label Feb 11, 2026
@platinummonkey platinummonkey merged commit 24e1a31 into DataDog:main Feb 11, 2026
4 checks passed
@robhughadams robhughadams deleted the feat/logs-storage-tier-support branch February 12, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants