Internet-Draft JMAP Debug April 2023
Baum & Happel Expires 8 October 2023 [Page]
Workgroup:
JMAP
Internet-Draft:
draft-baum-jmap-debug-00
Published:
Intended Status:
Standards Track
Expires:
Authors:
J.M. Baum, Ed.
audriga
H.J. Happel, Ed.
audriga

JMAP Debug Logging

Abstract

This document specifies a data model for extending the JMAP Response with log messages, particularly helpful for debugging.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 8 October 2023.

1. Introduction

Data exchanges between JMAP clients and server typically produces log lines from both the client and the server. Usually, logs are either stored locally on the instances or sent to a dedicated logging server. However, JMAP can also be used to supply log messages along-side the usual data exchange. This also removes the need to operate a separate logging infrastructure or have dedicated channels for log messages.

This extension adds a logs property to the JMAP method response (defined in RFC8620 Section 3.4) which contains the log lines of the JMAP server.

An example use case would be a JMAP API software running on a third party infrastructure in which log messages from the API cannot be sent to a dedicated logging service. Access to the third party infrastructure is restrictive in the sense that only access to the JMAP API endpoint is provided.

1.1. Conventions Used In This Document

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

The definitions of JSON keys and datatypes in the document follow the conventions described in the core JMAP specification [RFC8620].

1.2. Addition to the Capabilities Object

The capabilities object is returned as part of the JMAP Session object; see [RFC8620], Section 2. This document defines one additional capability URI.

1.2.1. urn:ietf:params:jmap:debug

Represents support for the logs property in the JMAP method response (defined in RFC8620 Section 3.4) and the LogLine data type.

The value of this property in the JMAP Session and account's capabilities property is an empty object.

2. Response extension

The Response object will be extended via:

  • logs: LogLine[] (optional) An array of log lines that were created while processing the request.

A LogLine object has the following properties:

  • level: String The log level of the log message. MUST be one of the eight levels defined in RFC5424: debug, info, notice, warning, error, critical, alert or emergency.
  • message: String The log message
  • timestamp: UTCDate The date the log message was logged.
  • class: String|null The name of the class that is currently logging.
  • file: String|null The file that initiated the log line.
  • line: String|null The exact line in the file where the log function is being called.

An example list of logs sent alongside a response to Core/echo would look like:

{
  "logs" : [
    {
      "file" : "Logger.php",
      "level" : "info",
      "line" : 32,
      "message" : "Array Logger has been successfully initialized",
      "timestamp" : "2022-01-18T10:26:56+01:00"
    },
    {
      "file" : "ErrorHandler.php",
      "level" : "warning",
      "line" : 52,
      "message" : "fopen(bridge.php):
        failed to open stream: No such file or directory",
      "timestamp" : "2022-01-18T10:26:56+01:00"
    },
    ...
  ],
  "methodResponses" : [
    [
      "Core/echo",
      ...

3. Security Considerations

Log messages might contain sensitive user data as well as detailed information about the system on which an API server has been installed. Appropriate measures must be taken to restrict access to JMAP Debug to trusted parties only.

4. IANA Considerations

4.1. JMAP Capability registration for "debug"

IANA is requested to register the "debug" JMAP Capability as follows:

Capability Name: urn:ietf:params:jmap:debug

Specification document: this document

Intended use: common

Change Controller: IETF

Security and privacy considerations: this document, Section 3.

4.2. JMAP Datatype Registration for "LogLine"

IANA will register the "LogLine" Data Type as folows:

Type Name: "LogLine"

Can reference blobs: No

Can use for state change: No

Capability: "urn:ietf:params:jmap:debug"

Reference: this document

5. Acknowledgements

Bron Gondwana, Neil Jenkins, Alexey Melnikov, Ken Murchison, Robert Stepanek and the JMAP working group at the IETF.

6. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
[RFC8620]
Jenkins, N. and C. Newman, "The JSON Meta Application Protocol (JMAP)", RFC 8620, DOI 10.17487/RFC8620, , <https://www.rfc-editor.org/info/rfc8620>.

Authors' Addresses

Joris Baum (editor)
audriga
Alter Schlachthof 57
76137 Karlsruhe
Germany
Hans-Joerg (editor)
audriga
Alter Schlachthof 57
76137 Karlsruhe
Germany