@@ -81,10 +81,15 @@ pub async fn ingest(
81
81
return Err ( PostError :: OtelNotSupported ) ;
82
82
}
83
83
84
+ let mut p_custom_fields = get_custom_fields_from_header ( & req) ;
85
+
84
86
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
+ ) ?,
88
93
_ => HashSet :: new ( ) ,
89
94
} ;
90
95
@@ -114,7 +119,7 @@ pub async fn ingest(
114
119
PARSEABLE
115
120
. add_update_log_source ( & stream_name, log_source_entry)
116
121
. await ?;
117
- let p_custom_fields = get_custom_fields_from_header ( req ) ;
122
+
118
123
flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
119
124
120
125
Ok ( HttpResponse :: Ok ( ) . finish ( ) )
@@ -198,7 +203,7 @@ pub async fn handle_otel_logs_ingestion(
198
203
. add_update_log_source ( & stream_name, log_source_entry)
199
204
. await ?;
200
205
201
- let p_custom_fields = get_custom_fields_from_header ( req) ;
206
+ let p_custom_fields = get_custom_fields_from_header ( & req) ;
202
207
203
208
flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
204
209
@@ -256,7 +261,7 @@ pub async fn handle_otel_metrics_ingestion(
256
261
. add_update_log_source ( & stream_name, log_source_entry)
257
262
. await ?;
258
263
259
- let p_custom_fields = get_custom_fields_from_header ( req) ;
264
+ let p_custom_fields = get_custom_fields_from_header ( & req) ;
260
265
261
266
flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
262
267
@@ -315,7 +320,7 @@ pub async fn handle_otel_traces_ingestion(
315
320
. add_update_log_source ( & stream_name, log_source_entry)
316
321
. await ?;
317
322
318
- let p_custom_fields = get_custom_fields_from_header ( req) ;
323
+ let p_custom_fields = get_custom_fields_from_header ( & req) ;
319
324
320
325
flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
321
326
@@ -363,13 +368,18 @@ pub async fn post_event(
363
368
. headers ( )
364
369
. get ( EXTRACT_LOG_KEY )
365
370
. and_then ( |h| h. to_str ( ) . ok ( ) ) ;
366
-
371
+ let mut p_custom_fields = get_custom_fields_from_header ( & req ) ;
367
372
match & log_source {
368
373
LogSource :: OtelLogs | LogSource :: OtelMetrics | LogSource :: OtelTraces => {
369
374
return Err ( PostError :: OtelNotSupported )
370
375
}
371
376
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
+ ) ?;
373
383
}
374
384
_ => { }
375
385
}
@@ -386,7 +396,7 @@ pub async fn post_event(
386
396
} )
387
397
. ok_or ( PostError :: IncorrectLogFormat ( stream_name. clone ( ) ) ) ?;
388
398
}
389
- let p_custom_fields = get_custom_fields_from_header ( req ) ;
399
+
390
400
flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
391
401
392
402
Ok ( HttpResponse :: Ok ( ) . finish ( ) )
0 commit comments