sonar-export-report

Generates a report file based on a report template and saves it to the specified path.

Command properties

ItemDescription
Command typeDriver query
Required permissionLogin required
License usageNot counted
Parallel executionNot supported
Distributed executionNot supported

Syntax

sonar-export-report template=STR format={docx|html|pdf|hwpx} from=STR to=STR path=STR

Options

template=STR
GUID of the report template
format={docx|html|pdf|hwpx}
Report file format
  • docx: Microsoft Word document
  • html: HTML document
  • pdf: PDF document
  • hwpx: Hangul (HWP) document
from=STR
Start time of the report data range. Specify in yyyyMMddHHmmss format. Trailing digits can be omitted and are filled with zeros.
to=STR
End time of the report data range. Specify in yyyyMMddHHmmss format. Trailing digits can be omitted and are filled with zeros.
path=STR
Path where the report file will be saved

Output fields

FieldTypeDescription
file_pathstringPath of the generated report file
file_namestringName of the generated report file
file_sizelongSize of the generated report file (bytes)

Error codes

Parse errors
Error codeMessageDescription
300101Invalid sonar session.The session is invalid or the user cannot be found.
300111Specify template option.The template option is missing.
300112Invalid template guid format.The template option value is not in GUID format.
300113Report template not found.No report template exists for the specified GUID.
300114Specify 'from' option in yyyyMMddHHmmss format.The from option is missing or has an invalid format.
300115Specify 'to' option in yyyyMMddHHmmss format.The to option is missing or has an invalid format.
300116Specify path option.The path option is missing.
300117Specify format option.The format option is missing.
Runtime errors
Error codeMessageDescriptionPost-processing
-report build task is cancelledThe report generation task was cancelled.Aborts the query.
-cannot find reportThe result cannot be found after report generation.Aborts the query.
-cannot write reportAn I/O error occurred while saving the report file.Aborts the query.

Description

The sonar-export-report command generates a report based on the specified template and time range, then saves the result to the specified file path. Report generation is processed asynchronously; the command waits until generation is complete before rendering.

If the parent directory of the output path does not exist, it is created automatically.

Examples

  1. Generate a PDF report

    sonar-export-report template=550e8400-e29b-41d4-a716-446655440000 format=pdf from=20260301 to=20260401 path=/opt/logpresso/reports/monthly.pdf
    

    Generates a PDF report for March 2026 using the specified template.

  2. Generate a DOCX report

    sonar-export-report template=550e8400-e29b-41d4-a716-446655440000 format=docx from=20260317000000 to=20260317235959 path=/opt/logpresso/reports/daily.docx
    

    Generates a Word report for March 17, 2026 using the specified template.