Skip to content

Commit bee99a2

Browse files
Merge pull request #716 from dgilman-perplexity/psi/default-flex-log-storage
feat(logs): default search storage to flex
2 parents a652c06 + 2161a0d commit bee99a2

3 files changed

Lines changed: 69 additions & 6 deletions

File tree

docs/EXAMPLES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ pup logs search --query="service:api" --from="7d" --storage="flex"
178178
# Search online archives (long-term storage)
179179
pup logs search --query="status:error" --from="30d" --storage="online-archives"
180180

181-
# Search standard indexes (default, fastest tier)
181+
# Search standard indexes (fastest tier)
182182
pup logs search --query="service:web-app" --from="1h" --storage="indexes"
183183

184-
# Use Datadog's default storage behavior
184+
# Search Flex logs by default
185185
pup logs search --query="status:warn" --from="1h"
186186
```
187187

src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,9 +1756,9 @@ enum Commands {
17561756
///
17571757
/// STORAGE TIERS:
17581758
/// Datadog logs can be stored in different tiers with different performance and cost characteristics:
1759-
/// • indexes - Standard indexed logs (default, real-time searchable)
1759+
/// • indexes - Standard indexed logs (real-time searchable)
17601760
/// • online-archives - Rehydrated logs from archives (slower queries, lower cost)
1761-
/// • flex - Flex logs (cost-optimized storage tier, balanced performance)
1761+
/// • flex - Flex logs (default for search and aggregate, cost-optimized storage tier)
17621762
///
17631763
/// LOG QUERY SYNTAX:
17641764
/// Logs use a query language similar to web search:
@@ -3154,7 +3154,11 @@ enum LogActions {
31543154
help = "Log indexes to aggregate, comma-separated or repeated"
31553155
)]
31563156
index: Vec<String>,
3157-
#[arg(long, help = "Storage tier: indexes, online-archives, or flex")]
3157+
#[arg(
3158+
long,
3159+
default_value = "flex",
3160+
help = "Storage tier: indexes, online-archives, or flex"
3161+
)]
31583162
storage: Option<String>,
31593163
},
31603164
/// List logs (v2 API)
@@ -3244,7 +3248,11 @@ enum LogActions {
32443248
group_by: Option<String>,
32453249
#[arg(long, default_value_t = 10, help = "Maximum groups per facet")]
32463250
limit: i32,
3247-
#[arg(long, help = "Storage tier: indexes, online-archives, or flex")]
3251+
#[arg(
3252+
long,
3253+
default_value = "flex",
3254+
help = "Storage tier: indexes, online-archives, or flex"
3255+
)]
32483256
storage: Option<String>,
32493257
#[arg(
32503258
long,

src/test_commands.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,61 @@ fn test_logs_list_sort_accepts_hyphen_timestamp() {
569569
}
570570
}
571571

572+
#[test]
573+
fn test_logs_search_and_aggregate_default_to_flex_storage() {
574+
use clap::Parser;
575+
576+
let search = crate::Cli::try_parse_from(["pup", "logs", "search", "--query", "*"])
577+
.expect("logs search should parse");
578+
let aggregate = crate::Cli::try_parse_from(["pup", "logs", "aggregate"])
579+
.expect("logs aggregate should parse");
580+
581+
match search.command {
582+
crate::Commands::Logs {
583+
action: crate::LogActions::Search { storage, .. },
584+
} => assert_eq!(storage.as_deref(), Some("flex")),
585+
_ => panic!("expected LogActions::Search"),
586+
}
587+
match aggregate.command {
588+
crate::Commands::Logs {
589+
action: crate::LogActions::Aggregate { storage, .. },
590+
} => assert_eq!(storage.as_deref(), Some("flex")),
591+
_ => panic!("expected LogActions::Aggregate"),
592+
}
593+
}
594+
595+
#[test]
596+
fn test_logs_search_and_aggregate_storage_overrides_are_preserved() {
597+
use clap::Parser;
598+
599+
let search = crate::Cli::try_parse_from([
600+
"pup",
601+
"logs",
602+
"search",
603+
"--query",
604+
"*",
605+
"--storage",
606+
"indexes",
607+
])
608+
.expect("logs search --storage indexes should parse");
609+
let aggregate =
610+
crate::Cli::try_parse_from(["pup", "logs", "aggregate", "--storage", "online-archives"])
611+
.expect("logs aggregate --storage online-archives should parse");
612+
613+
match search.command {
614+
crate::Commands::Logs {
615+
action: crate::LogActions::Search { storage, .. },
616+
} => assert_eq!(storage.as_deref(), Some("indexes")),
617+
_ => panic!("expected LogActions::Search"),
618+
}
619+
match aggregate.command {
620+
crate::Commands::Logs {
621+
action: crate::LogActions::Aggregate { storage, .. },
622+
} => assert_eq!(storage.as_deref(), Some("online-archives")),
623+
_ => panic!("expected LogActions::Aggregate"),
624+
}
625+
}
626+
572627
#[test]
573628
fn test_logs_saved_views_create_parses() {
574629
use clap::Parser;

0 commit comments

Comments
 (0)