]> git.ipfire.org Git - suricata-reporter.git/commitdiff
generator: Make the host clearer on the title page
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Sep 2025 11:14:47 +0000 (11:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Sep 2025 11:14:47 +0000 (11:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/suricata-report-generator.in

index 7913a4e8468ea30ebd019e67f48f8d21a4089a53..8c985c0eb76383397383aa41a7554aa354bae6c7 100644 (file)
@@ -91,6 +91,14 @@ class ReportGenerator(object):
                for style in ("Normal", "Title", "Heading1", "Heading2"):
                        self.styles[style].fontName = "Prompt"
 
+               # Create a subtitle style
+               subtitle = reportlab.lib.styles.ParagraphStyle(
+                       name      = "Subtitle",
+                       parent    = self.styles["Title"],
+                       fontSize  = 14,
+               )
+               self.styles.add(subtitle)
+
                # Allow to center content
                centered = reportlab.lib.styles.ParagraphStyle(
                        name      = "Centered",
@@ -202,6 +210,9 @@ class ReportGenerator(object):
                """
                date_format = "%d %B %Y"
 
+               # Fetch the hostname
+               hostname = socket.gethostname()
+
                # What time is it right now?
                now = datetime.datetime.now()
 
@@ -213,6 +224,11 @@ class ReportGenerator(object):
                        _("IPFire Intrusion Prevention Alert Report"), self.styles["Title"],
                ))
 
+               # Show the hostname
+               elements.append(reportlab.platypus.Paragraph(
+                       hostname, self.styles["Subtitle"],
+               ))
+
                # Only show one date if this is a daily report
                if date_start == date_end:
                        elements.append(
@@ -235,15 +251,12 @@ class ReportGenerator(object):
                        )
 
                # Leave some extra space
-               elements.append(reportlab.platypus.Spacer(1, 1 * cm))
+               elements.append(reportlab.platypus.Spacer(1, 10 * cm))
 
                # Show when this report was generated and on which host
                elements.append(
                        reportlab.platypus.Paragraph(
-                               _("Generated on %(hostname)s on %(when)s.") % {
-                                       "hostname" : socket.gethostname(),
-                                       "when"     : now.strftime("%d %B %Y %H:%M"),
-                               },
+                               _("Generated %s") % now.strftime("%d %B %Y %H:%M"),
                                self.styles["Centered"],
                        ),
                )