Skip to content

CAN Log Analyzer

A web-based tool for analyzing CAN log files using Streamlit, Plotly, and cantools.

Features

  • Upload and parse CAN log files (.asc, .blf)
  • Load CAN database files (.dbc)
  • Visualize and plot selected CAN signals interactively
  • User-friendly web interface with sidebar controls
  • Interactive signal selection and customizable plots (scatter, line, heatmap)
  • Grid and axis customization for detailed analysis

Notes

  • Ensure you are using Python 3.9–3.13 as specified in the project requirements.
  • Only .dbc files are supported for CAN database input.

Usage - Web App

To start the web application, run:

python -m can_log_analyzer.run_web_app
  • The app will launch in your default web browser at http://localhost:8501 (unless otherwise configured).
  • Use the sidebar to upload your CAN log files (.asc, .blf) and CAN database files (.dbc).
  • Select channels, messages, and signals to visualize.
  • Choose plot type and customize grid/axis options as needed.
  • Interactive plots and analysis will be available after loading your files.

source manual


WebApp

Streamlit CAN Log Analyzer Web Application.

Provides a Streamlit-based web interface for uploading, parsing, and visualizing CAN log files and databases. Supports DBC and ARXML database formats, ASC and BLF log formats, and interactive signal plotting using Plotly.

Features
  • Upload and parse CAN log and database files.
  • Select channels, messages, and signals for plotting.
  • Visualize signals as scatter, line, or heatmap plots.

load_database(file) staticmethod

Load a CAN database file (.dbc) using cantools.

Parameters:

Name Type Description Default
file Any

Uploaded file object from Streamlit.

required

Returns:

Type Description
Optional[Database]

Optional[cantools.database.Database]: Parsed CAN database object, or None on failure.

load_log(log_bytes, ext) staticmethod

Parse a CAN log file (.asc or .blf) and return structured data.

Parameters:

Name Type Description Default
log_bytes bytes

Raw bytes of the uploaded CAN log file.

required
ext str

File extension (should be '.asc' or '.blf').

required

Returns:

Type Description
Dict[int, Dict[int, List[dict]]]

Dict[int, Dict[int, List[dict]]]: Nested dictionary mapping channel and message ID

Dict[int, Dict[int, List[dict]]]

to a list of message entries with timestamp and data.

plot_signals(entries, message, signals, plot_type, plot_mode, show_grid, xaxis_grid_dtick=None) staticmethod

Plot selected CAN signals using Plotly.

Parameters:

Name Type Description Default
entries List[dict]

List of CAN message entries (timestamp and data).

required
message Message

CAN message definition.

required
signals List[str]

List of signal names to plot.

required
plot_type str

Type of plot ('Scatter', 'Line', or 'Heatmap').

required
plot_mode str

Plot mode ('Separate Plots' or 'Single Plot').

required
show_grid bool

Whether to show grid lines on the plot.

required
xaxis_grid_dtick Optional[float]

X-axis grid interval (None for auto).

None

run() classmethod

Main entry point for the Streamlit web app.

Handles the UI workflow: file upload, database and log parsing, selection of channels/messages/signals, and plotting.

upload_files() staticmethod

Display file upload widgets for CAN log and database files in the sidebar.

Returns:

Type Description
Optional[Any]

Tuple[Optional[Any], Optional[Any]]: The uploaded CAN log file and database file objects,

Optional[Any]

or None if not provided.