[Json] More on log file formats

Phillip Hallam-Baker <hallam@gmail.com> Tue, 06 May 2014 00:53 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6452F1A01DF for <json@ietfa.amsl.com>; Mon, 5 May 2014 17:53:42 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.101
X-Spam-Level:
X-Spam-Status: No, score=-0.101 tagged_above=-999 required=5 tests=[BAYES_40=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, SPF_PASS=-0.001] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wvEz17FJbOcQ for <json@ietfa.amsl.com>; Mon, 5 May 2014 17:53:41 -0700 (PDT)
Received: from mail-la0-x231.google.com (mail-la0-x231.google.com [IPv6:2a00:1450:4010:c03::231]) by ietfa.amsl.com (Postfix) with ESMTP id A8EED1A01D7 for <json@ietf.org>; Mon, 5 May 2014 17:53:40 -0700 (PDT)
Received: by mail-la0-f49.google.com with SMTP id hr17so5300843lab.36 for <json@ietf.org>; Mon, 05 May 2014 17:53:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9cDMmHSJ0/GAbPloC+KQw60DLDoRD5vO6AOBibhtMCE=; b=D6OyUKovrRlw9YXKIR/M0OU284F/VpAwrLPZ+f0OppgPek2eqRHxWbPm7j8cYzAg8A IMgJDA2gydwwEnXOPT8/A21PAmiO+KA+jTdotB+KijgKUSPkggtVv7h22b41y4pK8Ur4 Z0x4/irQTn4ZgibAQw3R4mvM6L7AlsvtKwItYX1f1r26lAjcuqAfa5n43uEMNIa0I6L4 JhtjrmEjgxwfqt1OsPYMk4iISMaLmAyg0ZwldtOM8I2KhIGe9QRYdrWI4AN7pRyr/m4a /Uv5YiN6EKZBdd/4cbaIsi6XUiG9OQphoGiByzzwGjESjqZYFFUTueWXK7eFxJh56X/A q+IA==
MIME-Version: 1.0
X-Received: by 10.112.128.131 with SMTP id no3mr64140lbb.57.1399337616427; Mon, 05 May 2014 17:53:36 -0700 (PDT)
Received: by 10.112.234.229 with HTTP; Mon, 5 May 2014 17:53:36 -0700 (PDT)
Date: Mon, 05 May 2014 20:53:36 -0400
Message-ID: <CAMm+LwjzTix0nbzq_i1VEUySEi79Wppa5s4FUEEsBiD2qL9+RQ@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: JSON WG <json@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: http://mailarchive.ietf.org/arch/msg/json/JXMo4QrchG5DYvphKO5PwMl8PPU
Subject: [Json] More on log file formats
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 06 May 2014 00:53:42 -0000

So I needed a log file today. And I would like it in JSON. But as
previously discussed, JSON does not work very well since we want to be
able to write out log file entries as
an append only operation.

I now have two reasons for why the way to write out the log file
entries is as a sequence of JSON objects without additional comas or
separators. Both have to do with the need to resynchronize.

The log file I am writing looks a bit like this:

{.A...}
{.B...}
{.C...}
{.D...}

Now lets imagine we have a million entries and a log file viewer that
is presenting the entries to the user, 40 at a time since thats what
will fit on the screen. I don't think we want to have to parse the
whole log file to present information buried in the middle of the
file.

Alternatively, lest imagine that the machine crashed while writing
entry C. Do we want this to corrupt all the entries that follow making
them unreadable? I certainly don't think so.


Both use cases create a requirement to be able to resynchronize the
reader to find the start of the next entry. This requires that there
be a sequence that cannot possibly occur within a legitimate JSON
object.

Looking for the sequence '}' WS* '{' allows a reader to resynchronize
to a legitimate start of entry marker.

-- 
Website: http://hallambaker.com/