Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/sources/demo_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use vector_lib::{
EstimatedJsonEncodedSizeOf,
};
use vrl::value::Kind;
use std::panic::AssertUnwindSafe;
use std::panic::catch_unwind;

use crate::{
codecs::{Decoder, DecodingConfig},
Expand Down Expand Up @@ -223,7 +225,14 @@ impl OutputFormat {
GenCtx::TimeJoin { data } => {
let (time_prefix, time_suffix) = &data[n % data.len()];
let now = Local::now();
let timestamp = now.format(&time_format).to_string();
let result = catch_unwind(AssertUnwindSafe(|| now.format(&time_format).to_string()));
let timestamp = match result {
Ok(v) => v,
Err(_) => {
// fallback to rfc3339 format: 2025-11-21T10:25:30.123456789Z
now.to_rfc3339()
}
};
format!("{}{}{}", time_prefix, timestamp, time_suffix)
}
GenCtx::None => {
Expand Down