@@ -81,10 +81,15 @@ pub async fn ingest(
8181 return Err ( PostError :: OtelNotSupported ) ;
8282 }
8383
84+ let mut p_custom_fields = get_custom_fields_from_header ( & req) ;
85+
8486 let fields = match & log_source {
85- LogSource :: Custom ( src) => {
86- KNOWN_SCHEMA_LIST . extract_from_inline_log ( & mut json, src, extract_log) ?
87- }
87+ LogSource :: Custom ( src) => KNOWN_SCHEMA_LIST . extract_from_inline_log (
88+ & mut json,
89+ & mut p_custom_fields,
90+ src,
91+ extract_log,
92+ ) ?,
8893 _ => HashSet :: new ( ) ,
8994 } ;
9095
@@ -114,7 +119,7 @@ pub async fn ingest(
114119 PARSEABLE
115120 . add_update_log_source ( & stream_name, log_source_entry)
116121 . await ?;
117- let p_custom_fields = get_custom_fields_from_header ( req ) ;
122+
118123 flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
119124
120125 Ok ( HttpResponse :: Ok ( ) . finish ( ) )
@@ -198,7 +203,7 @@ pub async fn handle_otel_logs_ingestion(
198203 . add_update_log_source ( & stream_name, log_source_entry)
199204 . await ?;
200205
201- let p_custom_fields = get_custom_fields_from_header ( req) ;
206+ let p_custom_fields = get_custom_fields_from_header ( & req) ;
202207
203208 flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
204209
@@ -256,7 +261,7 @@ pub async fn handle_otel_metrics_ingestion(
256261 . add_update_log_source ( & stream_name, log_source_entry)
257262 . await ?;
258263
259- let p_custom_fields = get_custom_fields_from_header ( req) ;
264+ let p_custom_fields = get_custom_fields_from_header ( & req) ;
260265
261266 flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
262267
@@ -315,7 +320,7 @@ pub async fn handle_otel_traces_ingestion(
315320 . add_update_log_source ( & stream_name, log_source_entry)
316321 . await ?;
317322
318- let p_custom_fields = get_custom_fields_from_header ( req) ;
323+ let p_custom_fields = get_custom_fields_from_header ( & req) ;
319324
320325 flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
321326
@@ -363,13 +368,18 @@ pub async fn post_event(
363368 . headers ( )
364369 . get ( EXTRACT_LOG_KEY )
365370 . and_then ( |h| h. to_str ( ) . ok ( ) ) ;
366-
371+ let mut p_custom_fields = get_custom_fields_from_header ( & req ) ;
367372 match & log_source {
368373 LogSource :: OtelLogs | LogSource :: OtelMetrics | LogSource :: OtelTraces => {
369374 return Err ( PostError :: OtelNotSupported )
370375 }
371376 LogSource :: Custom ( src) => {
372- KNOWN_SCHEMA_LIST . extract_from_inline_log ( & mut json, src, extract_log) ?;
377+ KNOWN_SCHEMA_LIST . extract_from_inline_log (
378+ & mut json,
379+ & mut p_custom_fields,
380+ src,
381+ extract_log,
382+ ) ?;
373383 }
374384 _ => { }
375385 }
@@ -386,7 +396,7 @@ pub async fn post_event(
386396 } )
387397 . ok_or ( PostError :: IncorrectLogFormat ( stream_name. clone ( ) ) ) ?;
388398 }
389- let p_custom_fields = get_custom_fields_from_header ( req ) ;
399+
390400 flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
391401
392402 Ok ( HttpResponse :: Ok ( ) . finish ( ) )
0 commit comments