module

Timeline

Instance methods

generate_frequency_timeline(logs : Array(Journalctl::LogEntry)) : Array(TimelinePoint)

Generates a timeline of log entry frequencies.

This function takes an array of log entries and groups them into time buckets based on the specified interval, counting the number of entries in each bucket.

Arguments:

  • logs: An array of Journalctl::LogEntry objects. It's assumed that each entry has a timestamp attribute of type Time. They will be bucketed hourly.

Returns:

An array of TimelinePoint named tuples, sorted chronologically by start_time. Each TimelinePoint contains the start_time of the bucket and the count of log entries within that bucket.

Source
generate_svg_timeline(timeline_data : Array(TimelinePoint), width : Int32 = 800, height : Int32 = 100, padding : Int32 = 10, bar_color : String = "steelblue", font_family : String = "Arial, sans-serif") : String

Generates an SVG representation of a timeline.

Arguments:

  • timeline_data: An array of TimelinePoint data to plot.
  • width: Total width of the SVG.
  • height: Total height of the SVG.
  • padding: Uniform padding around the chart area.
  • bar_color: Color of the bars.
  • font_family: Font family for text elements in the SVG. (No longer used as text elements are removed)

Returns:

  • A string containing the SVG markup.
Source

Nested types