Package com.tccc.kos.core.service.log
Interface LogExporter
public interface LogExporter
A
LogExporter
is responsible for exporting log archive files
to a destination, such as a cloud service. Exporters only exist on the
primary node and are automatically detected by LogServer
. The
exporter will be passed an InputStream to a log archive file and it is
responsible for copying the stream to some destination. By returning
successfully, the exporter indicates that the file was successfully
exported. The log file will then be marked successfully exported by
this exporter. By throwing an exception, the exporter indicates that
the export failed and the export will be tried again later.- Since:
- 1.7
- Version:
- 2025-03-07
-
Method Summary
Modifier and TypeMethodDescriptionvoid
exportLogArchive
(LogArchiveFile file, InputStream is) Called byLogServer
to export aLogArchiveFile
via the supplied input stream.Return the name of the exporter.boolean
Return true if the exporter is active.
-
Method Details
-
getExporterName
String getExporterName()Return the name of the exporter. This name is used to record successful exports so changing the name may result in requests to export logs that were previously exported. -
isExporterActive
boolean isExporterActive()Return true if the exporter is active. This indicates that export requests can be serviced. If an exporter can detect that is does not have the ability to export logs (network issues, disabled, etc...) then it should return false which will cause the exporter to be ignored.This is polled during the natural scheduling process for exporting logs and results in the exporter being skipped when not active.
If an exporter becomes active, it can wait for the current delay cycle to complete before it is checked, or it can call
logServer.active(exporter)
to indicate that the exporter is now available for use. This will cause the delay to be aborted and the exporter to be checked again. -
exportLogArchive
Called byLogServer
to export aLogArchiveFile
via the supplied input stream. The exporter should attempt to export the contents of the log. If successful simply return and the log file will be marked as successfully exported. This log file will never be passed to the exporter again. To indicate that the export failed, this method should throw an exception. The log will then be retried again at a later time.The log file may be streamed from a remote node via the input stream.
- Parameters:
file
- meta data about the log file to exportis
- input stream to read the log file- Throws:
Exception
-