Skip to content

Commit

Permalink
✨ Add '@timestamp' field to mapping logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukan10 committed Aug 28, 2024
1 parent c88023b commit 7972d36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ case class FhirMappingJobResult(mappingJobExecution: FhirMappingJobExecution,
markerMap.put("eventId", eventId)
markerMap.put("isStreamingJob", mappingJobExecution.isStreamingJob)
markerMap.put("isScheduledJob", mappingJobExecution.isScheduledJob)
// The current timestamp is automatically added to the log entry when it is sent to Elasticsearch or written to a file.
// As a result, there is no need to manually add a "@timestamp" field.
// However, during the process of writing the log to Elasticsearch, the timestamp is rounded, resulting in a loss of precision.
// For example, "2024-08-28_13:54:44.740" may be rounded to "2024-08-28_13:54:44.000" in Elasticsearch.
// This rounding leads to the loss of crucial millisecond information, which is important for accurately sorting logs.
markerMap.put("@timestamp", System.currentTimeMillis.toString)
// create a new MapMarker using the marker map
new MapMarker("marker", markerMap)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ case class FhirMappingResult(
markerMap.put("errorDesc", error.get.description)
markerMap.put("errorExpr", error.get.expression.getOrElse(""))
markerMap.put("eventId", eventId)
// The current timestamp is automatically added to the log entry when it is sent to Elasticsearch or written to a file.
// As a result, there is no need to manually add a "@timestamp" field.
// However, during the process of writing the log to Elasticsearch, the timestamp is rounded, resulting in a loss of precision.
// For example, "2024-08-28_13:54:44.740" may be rounded to "2024-08-28_13:54:44.000" in Elasticsearch.
// This rounding leads to the loss of crucial millisecond information, which is important for accurately sorting logs.
markerMap.put("@timestamp", System.currentTimeMillis.toString)
// create a new MapMarker using the marker map
val marker: MapMarker = new MapMarker("marker", markerMap)
// add mappedResource to the marker map if error code is INVALID_RESOURCE
Expand Down

0 comments on commit 7972d36

Please sign in to comment.