OCPP messages cover the protocol-level interactions between charger and CSMS. But chargers run firmware that does a great deal below the OCPP layer: vehicle communication negotiation, internal state machines, hardware control, error handling. When something goes wrong down there, OCPP messages give you hints and never the full picture.
That’s what logs are for. Chargers maintain internal logs of detailed operational events. OCPP provides messages to retrieve these logs for offline analysis.
This article covers GetDiagnostics (1.6), GetLog (2.0.1), the upload pattern, and the operational patterns that make log retrieval useful.
The basic concept
The CSMS asks the charger for its log files. The charger uploads them to a URL the CSMS specifies. The CSMS reviews the log file separately.
The CSMS doesn’t pull the log; the charger pushes it. This is because:
- Charger may be behind NAT (can’t be reached directly).
- Log files can be large; HTTP upload from charger is simpler than CSMS-side download.
- Upload semantics work in cellular environments more reliably than pull.
sequenceDiagram
participant CSMS
participant Charger
participant Store as Upload URL
CSMS->>Charger: GetDiagnostics or GetLog with URL
Charger-->>CSMS: Response with file name
Charger->>Charger: Collect and compress
Charger->>CSMS: Status notification: Uploading
Charger->>Store: Upload log file
Charger->>CSMS: Status notification: Uploaded
OCPP 1.6: GetDiagnostics
[2, "gd-1", "GetDiagnostics", {
"location": "ftp://diag:s3cret@logs.example.com/uploads/",
"retries": 3,
"retryInterval": 60,
"startTime": "2026-11-27T00:00:00Z",
"stopTime": "2026-11-28T00:00:00Z"
}]
- location. Required. The 1.6 specification calls it the location (directory) the file is uploaded to. FTP URLs are common on 1.6, HTTP(S) on newer firmware.
- retries / retryInterval. Retry policy on upload failure.
- startTime / stopTime. Optional date range for the log content.
[3, "gd-1", { "fileName": "CP-0042_20261128T0915.tar.gz" }]
fileName is optional: a charger with no diagnostic information leaves it out, and an empty response means nothing will be uploaded. Then the charger collects the data, compresses it (tar.gz and zip are both common; the format is not prescribed) and uploads it, reporting progress:
[2, "ds-7", "DiagnosticsStatusNotification", { "status": "Uploading" }]
[2, "ds-8", "DiagnosticsStatusNotification", { "status": "Uploaded" }]
Notice what is missing: DiagnosticsStatusNotification has no request id. If two people request logs from the same charger, you can’t tell which upload a status belongs to. Serialize requests per charger in your CSMS.
Chargers that implement the OCPP 1.6 security extension also support GetLog and LogStatusNotification, with the same fields as 2.0.1 below. That is the only way to get the SecurityLog from a 1.6 charger.
OCPP 2.0.1: GetLog
[2, "gl-1", "GetLog", {
"log": {
"remoteLocation": "https://logs.example.com/upload/CP-0042/",
"oldestTimestamp": "2026-11-27T00:00:00Z",
"latestTimestamp": "2026-11-28T00:00:00Z"
},
"logType": "DiagnosticsLog",
"requestId": 9876,
"retries": 3,
"retryInterval": 60
}]
- logType. DiagnosticsLog (general diagnostics) or SecurityLog (security events). OCPP 2.1 adds DataCollectorLog, for the high-rate measurand samples of the optional DataCollector component.
- requestId. Correlation id. Every LogStatusNotification for this upload carries the same value.
- remoteLocation. Up to 512 characters; the URL scheme picks the protocol. The station lists what it supports in the FileTransferProtocols variable.
[3, "gl-1", { "status": "Accepted", "filename": "CP-0042_diag_20261128.zip" }]
The station answers Rejected if the requested log is not available, and AcceptedCanceled if it was already assembling or uploading a log: it cancels the old upload and starts the new one. Mind the spelling change, too: fileName in 1.6, filename in GetLog.
[2, "ls-1", "LogStatusNotification", { "status": "Uploading", "requestId": 9876 }]
[2, "ls-2", "LogStatusNotification", { "status": "Uploaded", "requestId": 9876 }]
Upload statuses and what to do with each
| 1.6 DiagnosticsStatus | 2.0.1 UploadLogStatus | Meaning | CSMS action |
|---|---|---|---|
| Uploading | Uploading | Upload started (2.0.1 may repeat it on each retry) | Start a timeout, for example retries × retryInterval plus transfer time |
| Uploaded | Uploaded | File delivered | Check the file actually landed and is not empty |
| UploadFailed | UploadFailure | Failed after the retries | Check URL reachability, TLS and credentials from the charger’s network |
| (none) | BadMessage | Protocol incompatibility with the upload server | Check the scheme and the server’s protocol support |
| (none) | PermissionDenied | Server refused the credentials | Fix credentials in the URL or the presigned URL’s permissions |
| (none) | NotSupportedOperation | Server doesn’t support the operation, for example a PUT where only POST is accepted | Accept both PUT and POST |
| (none) | AcceptedCanceled | An older upload was cancelled for a newer request | Mark the older request as superseded |
| Idle | Idle | Nothing uploading; only sent in answer to a TriggerMessage | Nothing in progress; request again if you expected a file |
Building the upload endpoint
The CSMS supplies the URL and the charger uploads to it. OCPP 2.1’s N01 requirements spell out what both sides should do with HTTP, and they explain most of the upload failures you will see:
- Accept both PUT and POST. The specification recommends that the server accepts both. A POST upload must carry a
Content-Typeand aContent-Dispositionwith the filename, as a multipart form upload does. - A trailing slash means “append the filename”. If
remoteLocationends with/, the station appends the filename it returned in the response; otherwise it uses the URL exactly as given. - No redirects. The station must not follow a redirect and reports UploadFailure instead. Point the URL at the storage endpoint itself, not at a service that answers 301 or 307.
- Use a separate upload password. For basic auth in the URL (
https://user:password@host/path), the specification recommends a different password from the OCPP connection, because the log store may be run by someone else. - Expect
Expect: 100-continue. For files over 1 MB the station may send that header on a PUT, and the server can refuse before the body is sent. Some proxies handle it badly. - Mind the trust chain. The station is only required to trust the CSMS’s certificate chain for secure transports; supporting the usual operating-system CAs is a recommendation. A presigned cloud storage URL signed by a public CA can fail TLS on a station that only knows your CSMS root.
Presigned object-storage URLs are still a good pattern, with two checks. They have no trailing slash, so the station must use them unchanged; and most presigned upload URLs accept only PUT, so a station that uploads with POST fails against them. On 1.6, where location is described as a directory, a charger may append its own file name to whatever you send, which also breaks a presigned URL. Test with each charger model before you rely on it.
For FTP, the station must be able to use passive mode, and the URL takes the form ftp://user:password@host:port/path.
What’s in a log
The exact content varies by OEM. Common things you’ll find:
Operational events:
- Power-on and power-off events.
- WebSocket connection attempts (success and failure).
- OCPP messages sent and received (sometimes redacted for size).
- Authorization decisions.
- Session start/stop with internal timestamps.
Hardware events:
- Contactor open/close events.
- Voltage and current measurements (with high granularity).
- Temperature sensor readings.
- Lock motor activations.
- ISO 15118 communication events.
- Pilot pin state changes.
Firmware events:
- Boot sequence details.
- Memory and storage status.
- Watchdog timer events.
- Crash dumps (if any).
Network events:
- Cellular signal strength.
- IP address changes.
- DNS resolutions.
- TLS handshake details.
Errors and warnings:
- All errors with stack traces or context.
- Warnings about marginal conditions.
The combination gives you a deep look at what happened on the charger during a specific time window.
When to retrieve logs
A few scenarios where log retrieval is the right move.
Suspected firmware bug. OCPP messages show something unexpected. Need internal details to diagnose.
Customer dispute. “I was charged for X kWh but my car says Y.” Logs show what the charger actually delivered.
Recurring fault investigation. A charger keeps going Faulted with the same errorCode. See common OCPP errors explained for how to read those codes; logs show what was happening at the time.
Pre-replacement diagnosis. Before sending a tech to replace hardware, pull logs to confirm the diagnosis.
Post-incident forensics. Something went wrong; need to know exactly what.
Vendor support escalation. OEM asks for logs to diagnose an issue. Standard ask.
When NOT to retrieve logs
Cases where log retrieval is overkill.
Routine monitoring. Logs are too detailed for daily ops. Use OCPP messages and dashboards.
Network-constrained scenarios. A cellular charger with limited data shouldn’t be pulling MBs of logs frequently. Save for genuine investigation.
Already-fixed issues. If you know what happened from OCPP messages alone, don’t waste time on logs.
Fleet-wide pulls. Don’t pull logs from every charger nightly “just in case.” Too much data; signal-to-noise is poor.
Operational patterns
A few patterns for using log retrieval effectively.
Reactive (problem investigation)
Charger has an issue. Operations team requests logs for the time window around the issue. CSMS sends GetDiagnostics. Charger uploads. Engineer reviews offline.
The most common use.
Proactive (suspected pattern)
Operations team notices a pattern (several chargers with similar issue). Pulls logs from affected sample. Identifies common root cause.
Valuable but requires effort to do well.
Scheduled (firmware update validation)
After pushing new firmware, pull diagnostics from a sample of chargers to verify the firmware is working correctly. Catch issues early before broad rollout.
On-demand (vendor support)
Vendor support team needs logs for ticket investigation. Operations facilitates the pull.
Practical considerations
A list of things to know.
Logs can be large. A week’s worth of detailed logs from a busy charger can be tens of MB. Plan storage.
Compression matters. Log files are highly repetitive text, so they compress well, and compressing before upload is the difference between a manageable transfer and a stalled one on a metered cellular link. Check whether your firmware does it rather than assuming.
Time-window selection. Narrow time windows = smaller logs = faster upload. Use as narrow a window as your investigation needs.
Upload bandwidth on cellular. A 50 MB log over cellular can take 10+ minutes and use significant data allowance. Avoid for routine pulls.
Logs may not include everything you want. Vendor decides what to log. If a specific event isn’t logged, you can’t retrieve it after the fact.
Retention on the charger. Chargers don’t store logs forever. Typically days to weeks of detail. For long-running issues, pull early.
Security and privacy
Logs can contain sensitive information.
Personal data. User identifiers (RFID UIDs), session details that may identify users.
Payment metadata. Sometimes, depending on what the charger logs.
Network credentials. Sometimes, depending on log verbosity.
Hardware identifiers. Always: serial numbers, MAC addresses, IMEI.
Handle logs accordingly:
- Store encrypted at rest.
- Limit access to those who need it.
- Define retention period.
- Honor user data-deletion requests by purging relevant logs.
- For GDPR / similar regulations, document what’s in logs and how it’s protected.
Common pitfalls
A few things that go wrong with log retrieval.
Upload URL not reachable. Charger tries to upload, can’t reach the URL. Firewall, DNS, TLS issue. Verify the upload endpoint from the charger’s network perspective, and check the TLS chain against the certificates the charger actually trusts.
Upload partial / corrupt. Network interruption mid-upload. Charger reports UploadFailed; need to retry.
Authentication mismatch. Upload endpoint requires auth that the charger doesn’t have. Pre-signed URLs avoid this, as long as the charger uploads with the method the URL was signed for.
Log filling local storage on charger. Some chargers rotate logs aggressively; long-window requests may return less than requested.
Vendor-specific log format. Each OEM has its own format. Parsing requires vendor-specific tooling or knowledge.
Privacy violations. Operator pulls logs containing user PII without proper handling. GDPR exposure.
What good log management looks like
For CSMS operators with mature log retrieval:
- On-demand pulling via operations dashboard. Operator selects charger, time range, clicks “Get Logs.”
- Pre-signed URLs generated automatically for the upload endpoint.
- Status tracked via DiagnosticsStatusNotification (1.6) or LogStatusNotification with its requestId (2.0.1). Operator sees upload progress.
- Logs stored in object storage with per-charger organization.
- Vendor-specific parsing tooling to extract insights.
- Searchable across logs. A fault that looks like a one-off on a single charger is often a pattern once you can query the whole fleet at once.
- Retention policy enforced (e.g. 90 days for routine, longer for incident investigations).
- Access controls. Only certain roles can pull logs; access is audited.
This level of maturity is common in larger operators. Smaller operators do it manually.
The honest summary
OCPP log retrieval is a powerful diagnostic tool that should be used deliberately. It’s overkill for routine monitoring but essential for investigation. Build solid tooling around the upload pattern, handle the privacy considerations carefully, and use it when OCPP messages alone don’t tell the whole story. Most production charger fleets pull logs occasionally; the discipline of doing it well separates effective operations from struggling ones.