Skip to content
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

chore(azure_monitor_logs sink): update log namespacing #16475

Merged
merged 9 commits into from
Mar 1, 2023
5 changes: 2 additions & 3 deletions src/sinks/azure_monitor_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,8 @@ impl HttpEventEncoder<serde_json::Value> for AzureMonitorLogsEventEncoder {
// it seems like Azure Monitor doesn't support full 9-digit nanosecond precision
// adjust the timestamp format accordingly, keeping only milliseconds
let mut log = event.into_log();
let timestamp_key = log_schema().timestamp_key();

let timestamp = if let Some(Value::Timestamp(ts)) = log.remove(timestamp_key) {
let timestamp = if let Some(Value::Timestamp(ts)) = log.remove_timestamp() {
ts
} else {
chrono::Utc::now()
Expand All @@ -212,7 +211,7 @@ impl HttpEventEncoder<serde_json::Value> for AzureMonitorLogsEventEncoder {
let mut entry = serde_json::json!(&log);
let object_entry = entry.as_object_mut().unwrap();
object_entry.insert(
timestamp_key.to_string(),
log_schema().timestamp_key().to_string(),
spencergilbert marked this conversation as resolved.
Show resolved Hide resolved
JsonValue::String(timestamp.to_rfc3339_opts(chrono::SecondsFormat::Millis, true)),
);

Expand Down