CAN_LOGGER(1)

πŸ“¦
version 4.6.1 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay so bestie, say hi to can_logger β€” section 1 of the manual, filed under User Commands, and it's literally the girl whose whole job is logging CAN traffic, printing messages to stdout or to a given file. ✨

  • can_logger β€” log CAN traffic, printing messages to stdout or to a given file πŸ’…

πŸŽ€ DESCRIPTION πŸŽ€

so like, here's the whole usage vibe, no cap:

usage: can_logger [-h] [-f LOG_FILE] [-a] [-s FILE_SIZE] [-v] [--active | --passive] [-c CHANNEL] [-i INTERFACE] [-b BITRATE] [--fd] [--data-bitrate DATA_BITRATE] [--timing TIMING_ARG [TIMING_ARG ...]] [--filter {<can_id>:<can_mask>,<can_id>~<can_mask>} [{<can_id>:<can_mask>,<can_id>~<can_mask>} ...]] [--bus-kwargs BUS_KWARG [BUS_KWARG ...]] ...

and the actual mission statement, bestie: Log CAN traffic, printing messages to stdout or to a given file. that's the whole thing. she's an icon, she's a legend, and she is the moment. πŸ‘‘


✨ options: ✨

  • -h, --help β€” shows this help message and dips. that's it, that's the whole vibe. 🫢

🌸 logger arguments: 🌸

  • -f, --file_name LOG_FILE β€” path and base log filename. for supported types see can.Logger. πŸ—‚οΈ
  • -a, --append β€” append to the log file if it already exists. no overwriting your faves, we respect her history. πŸ’œ
  • -s, --file_size FILE_SIZE β€” maximum file size in bytes. rotates the log file when the size threshold is reached. (the resulting file sizes will be consistent, but are not guaranteed to be exactly what is specified here due to the rollover conditions being logger implementation specific.) so like, close enough bestie, it's giving "approximately iconic". 😭
  • -v β€” how much information do you want to see at the command line? you can add several of these e.g., -vv is DEBUG. the more vs, the more she tells you. main character energy, honestly. πŸ’…
  • --active β€” start the bus as active, this is applied by default. ✨
  • --passive β€” start the bus as passive. πŸ™ˆ
  • extra_args β€” the remaining arguments will be used for logger/player initialisation. for example, can_logger -i virtual -c test -f logfile.blf --compression-level=9 passes the keyword argument compression_level=9 to the BlfWriter. sneaky little extra args, we love them. πŸŽ€

πŸ”₯ bus arguments: πŸ”₯

  • -c, --channel CHANNEL β€” most backend interfaces require some sort of channel. for example with the serial interface the channel might be a rfcomm device: "/dev/rfcomm0". with the socketcan interface valid channel examples include: "can0", "vcan0". 🚌
  • -i, --interface {canalystii,cantact,etas,gs_usb,iscan,ixxat,kvaser,neousys,neovi,nican,nixnet,pcan,robotell,seeedstudio,serial,slcan,socketcan,socketcand,systec,udp_multicast,usb2can,vector,virtual} β€” specify the backend CAN interface to use. if left blank, fall back to reading from configuration files. pick your fighter, bestie. 🌈
  • -b, --bitrate BITRATE β€” bitrate to use for the CAN bus. ⚑
  • --fd β€” activate CAN-FD support. fancy mode: ON. πŸ”₯
  • --data-bitrate DATA_BITRATE β€” bitrate to use for the data phase in case of CAN-FD. πŸ¦‹
  • --timing TIMING_ARG [TIMING_ARG ...] β€” configure bit rate and bit timing. for example, use --timing f_clock=8_000_000 tseg1=5 tseg2=2 sjw=2 brp=2 nof_samples=1 for classical CAN or --timing f_clock=80_000_000 nom_tseg1=119 nom_tseg2=40 nom_sjw=40 nom_brp=1 data_tseg1=29 data_tseg2=10 data_sjw=10 data_brp=1 for CAN FD. check the pythoncan documentation to verify whether your CAN interface supports the timing argument. πŸ‘‘
  • --filter {<can_id>:<can_mask>,<can_id>~<can_mask>} [{<can_id>:<can_mask>,<can_id>~<can_mask>} ...] β€” R|Space separated CAN filters for the given CAN interface:
    • <can_id>:<can_mask> (matches when <received_can_id> & mask == can_id & mask)
    • <can_id>~<can_mask> (matches when <received_can_id> & mask != can_id & mask)

fx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F:

python3 -m can.viewer --filter 100:7FC 200:7F0

note that the ID and mask are always interpreted as hex values. periodt. πŸ’―

  • --bus-kwargs BUS_KWARG [BUS_KWARG ...] β€” pass keyword arguments down to the instantiation of the bus class. for example, -i vector -c 1 --buskwargs app_name=MyCanApp serial=1234 is equivalent to opening the bus with can.Bus('vector', channel=1, app_name='MyCanApp', serial=1234). yes bestie, the args go all the way down. 🫢

ngl this page is from can_logger version 4.6.1, dated October 2025, and it lives in the CAN_LOGGER(1) manual. slay, go log something. πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from