Class CloudWatchLogsExporter
java.lang.Object
codes.grow.packages.cloudwatchlogs.CloudWatchLogsExporter
- All Implemented Interfaces:
LogExporter
Exports log records with
PutLogEvents to one group/stream (SPEC section 4
LogExporter, API.md section 3). The message of each event is the normalized LogRecord JSON
(redaction already applied by the log client); the event timestamp is the record timestamp in
milliseconds. The gzip option is ignored: PutLogEvents has no request compression in the
AWS API model.-
Method Summary
Modifier and TypeMethodDescriptionexport(List<LogRecord> records, ExportOptions options) Exports a batch.group()Returns the log group.static StringrecordToMessage(LogRecord record, int maxEventBytes, OversizePolicy policy) Serialises a record to its normalized JSON message.shutdown()Releases resources.stream()Returns the log stream.
-
Method Details
-
group
Returns the log group.- Returns:
- the group
-
stream
Returns the log stream.- Returns:
- the stream
-
recordToMessage
Serialises a record to its normalized JSON message. When the message is larger thanmaxEventBytes,OversizePolicy.TRUNCATEshortens the record body so the message stays valid JSON (falling back to a plain cut only when the other fields alone are too large);OversizePolicy.DROPandOversizePolicy.ERRORreturn null.- Parameters:
record- the recordmaxEventBytes- per-event limitpolicy- oversize policy- Returns:
- the message, or null when the record is left out
-
export
Description copied from interface:LogExporterExports a batch. The future completes with the accepted/rejected counts; it may also complete exceptionally (treated as "all rejected"). Cancelling the future cancels the export.- Specified by:
exportin interfaceLogExporter- Parameters:
records- records to send (never empty)options- gzip flag and time budget- Returns:
- the export result
-
shutdown
Description copied from interface:LogExporterReleases resources. Called once byBatchProcessor.shutdown.- Specified by:
shutdownin interfaceLogExporter- Returns:
- completes when the exporter is closed
-