How to Access TeslaMate Logs: Docker Container Logging Guide
You access TeslaMate logs by reading the Docker container's standard output using commands like docker logs or docker compose logs, since the application writes all runtime messages via the Elixir Logger to stdout.
Since TeslaMate runs inside Docker containers as part of the teslamate-org/teslamate repository, it does not write to traditional log files on the host filesystem. Instead, the application streams runtime messages to the container's stdout, which you can access using standard Docker commands. Understanding how to access TeslaMate logs is essential for troubleshooting vehicle data synchronization issues and monitoring the application's health.
Checking TeslaMate Logs with Docker CLI
The most direct way to access TeslaMate logs is using the Docker command line interface to read the container's output buffer.
Viewing Historical Logs
To display the contents of the log buffer for a specific container, use the docker logs command:
# Show the last 100 lines of the TeslaMate container logs
docker logs --tail 100 teslamate_1
Replace teslamate_1 with your actual container name, which you can find by running docker ps.
Following Live Logs with Docker Compose
For a live tail of new log entries as they occur, use the -f (follow) flag with Docker Compose:
# Follow the logs in real time (Ctrl-C to stop)
docker compose logs -f teslamate
This command attaches to the teslamate service defined in your docker-compose.yml and streams output continuously.
Filtering and Searching TeslaMate Logs
When you need to find specific events, pipe the output to standard Unix text processing tools.
To isolate specific messages such as suspension events:
# Show only "Suspending logging" events
docker compose logs teslamate | grep "Suspending logging"
You can also combine flags to limit the output and search simultaneously:
docker logs --tail 1000 teslamate_1 | grep "error"
Understanding the Log Source Code
The log messages originate from the TeslaMate.Log context in the Elixir source code. According to the teslamate-org/teslamate repository, the lib/teslamate/log.ex file contains functions like start_state/3 that invoke the Elixir Logger.
For example, when the system suspends logging for a vehicle, the code executes:
Logger.info("[info] Suspending logging")
This produces the log line referenced in the project's FAQ documentation (website/docs/faq.md). The logging logic also references the lib/teslamate/log/state.ex schema, which defines the Ecto data structure for vehicle states.
Configuring Timezone for Accurate Timestamps
By default, Docker containers use UTC time, which can cause timestamp mismatches in your logs. To display timestamps in your local timezone, set the TZ environment variable.
You can configure this in your docker-compose.yml or pass it directly when running commands, as documented in website/docs/configuration/environment_variables.md:
# Show logs with timestamps adjusted to your local timezone (e.g., Europe/Berlin)
docker compose run --rm \
-e TZ=Europe/Berlin \
teslamate \
sh -c "docker logs -f teslamate"
Alternatively, add the environment variable to your Docker Compose configuration for persistent timezone settings across all docker compose logs commands.
Summary
- TeslaMate logs are written to Docker container stdout via the Elixir Logger, not to physical files on the host.
- Use
docker logs --tail <n> <container>to view historical entries ordocker compose logs -f teslamatefor real-time streaming. - Search specific events by piping output to
grepor other text processing tools. - Log messages originate from
lib/teslamate/log.exfunctions such asstart_state/3. - Set the TZ environment variable to convert timestamps from UTC to your local timezone.
Frequently Asked Questions
Where are TeslaMate log files stored?
TeslaMate does not write log files to disk in the traditional sense. Instead, as implemented in teslamate-org/teslamate, the application uses the Elixir Logger to write runtime messages to the Docker container's standard output (stdout). You access these messages using docker logs or docker compose logs commands rather than browsing filesystem directories.
How do I view TeslaMate logs in real-time?
To view logs in real-time, use the follow flag with Docker Compose: docker compose logs -f teslamate. This command attaches to the running container and displays new log entries as they are generated by the Elixir Logger, allowing you to monitor vehicle data synchronization and system events as they occur.
Why do my TeslaMate logs show UTC timestamps?
Docker containers default to UTC timezone. According to the environment variables documentation in website/docs/configuration/environment_variables.md, you can set the TZ environment variable (e.g., TZ=America/New_York) in your Docker Compose configuration to ensure the Elixir Logger outputs timestamps in your local timezone rather than Coordinated Universal Time.
What does "Suspending logging" mean in TeslaMate?
The "Suspending logging" message appears when the start_state/3 function in lib/teslamate/log.ex detects that the vehicle has gone to sleep or the logging process is being paused to conserve API rate limits. This Info-level log entry is generated via Logger.info("[info] Suspending logging") and indicates that TeslaMate has temporarily stopped polling the Tesla API for that vehicle until activity resumes.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →