CAN_LOGGER(1)
π 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_nameLOG_FILE β path and base log filename. for supported types seecan.Logger. ποΈ-a,--appendβ append to the log file if it already exists. no overwriting your faves, we respect her history. π-s,--file_sizeFILE_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.,-vvis DEBUG. the morevs, 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=9passes the keyword argumentcompression_level=9to the BlfWriter. sneaky little extra args, we love them. π
π₯ bus arguments: π₯
-c,--channelCHANNEL β 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,--bitrateBITRATE β bitrate to use for the CAN bus. β‘--fdβ activate CAN-FD support. fancy mode: ON. π₯--data-bitrateDATA_BITRATE β bitrate to use for the data phase in case of CAN-FD. π¦--timingTIMING_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=1for 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=1for CAN FD. check the pythoncan documentation to verify whether your CAN interface supports thetimingargument. π--filter{<can_id>:<can_mask>,<can_id>~<can_mask>}[{<can_id>:<can_mask>,<can_id>~<can_mask>}...] βR|Spaceseparated 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-kwargsBUS_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=1234is equivalent to opening the bus withcan.Bus('vector', channel=1, app_name='MyCanApp', serial=1234). yes bestie, the args go all the way down. π«Ά
ngl this page is fromcan_loggerversion4.6.1, datedOctober 2025, and it lives in theCAN_LOGGER(1)manual. slay, go log something. πβ¨π
π¦ where this page comes from
- ubuntu resolute: python3-can 4.6.1-4 Β· LGPL-3.0-only
- ubuntu stonking: python3-can 4.6.1-4 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms