Re: [Json] JSON Log file encoding JSON-L

Nico Williams <nico@cryptonector.com> Tue, 06 May 2014 07:01 UTC

Return-Path: <nico@cryptonector.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 24F381A00FA for <json@ietfa.amsl.com>; Tue, 6 May 2014 00:01:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.044
X-Spam-Level:
X-Spam-Status: No, score=-1.044 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, IP_NOT_FRIENDLY=0.334] autolearn=no
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 FlqQHypir_nj for <json@ietfa.amsl.com>; Tue, 6 May 2014 00:01:52 -0700 (PDT)
Received: from homiemail-a84.g.dreamhost.com (sub4.mail.dreamhost.com [69.163.253.135]) by ietfa.amsl.com (Postfix) with ESMTP id 6A6251A00BA for <json@ietf.org>; Tue, 6 May 2014 00:01:52 -0700 (PDT)
Received: from homiemail-a84.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a84.g.dreamhost.com (Postfix) with ESMTP id 9A57A1DE070 for <json@ietf.org>; Tue, 6 May 2014 00:01:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type; s=cryptonector.com; bh=7huoIl43w3vryvQiAmpV v2qCnpI=; b=nJcXvYxDU4XTr27UzICsY/I9P2/qy0WbBtMNy2XywJ2R/AhqojFk S3b/mlJCyeKfZJpDkhz4j92UtX+mK9wjyZrJK7f4UYfVp9Fyhil9jtbMar8WZlbl +d4af+tpWie5ClJTcfBJoD6rK+hoyvXpVmb1qn0zEiZ0FqyiT/F4OKg=
Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by homiemail-a84.g.dreamhost.com (Postfix) with ESMTPSA id 4F6CF1DE05D for <json@ietf.org>; Tue, 6 May 2014 00:01:48 -0700 (PDT)
Received: by mail-wi0-f173.google.com with SMTP id bs8so6723956wib.12 for <json@ietf.org>; Tue, 06 May 2014 00:01:47 -0700 (PDT)
MIME-Version: 1.0
X-Received: by 10.180.77.225 with SMTP id v1mr972497wiw.5.1399359707020; Tue, 06 May 2014 00:01:47 -0700 (PDT)
Received: by 10.216.29.200 with HTTP; Tue, 6 May 2014 00:01:46 -0700 (PDT)
In-Reply-To: <CAMm+LwjB-51z4GoeC0riehmJg1HAddmLAyfMsVOCVM80i=RiMA@mail.gmail.com>
References: <CAMm+LwjB-51z4GoeC0riehmJg1HAddmLAyfMsVOCVM80i=RiMA@mail.gmail.com>
Date: Tue, 06 May 2014 02:01:46 -0500
Message-ID: <CAK3OfOgX06vkOS1+CJhsptMAvm+KX1HgB2=34ubxUCtHNVnx=A@mail.gmail.com>
From: Nico Williams <nico@cryptonector.com>
To: Phillip Hallam-Baker <hallam@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Archived-At: http://mailarchive.ietf.org/arch/msg/json/KRu9HgdUg1pDVR6PvQW66ehzfaE
Cc: JSON WG <json@ietf.org>
Subject: Re: [Json] JSON Log file encoding JSON-L
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 07:01:53 -0000

For a variety of reasons I would prefer that a log file format based
on JSON simply forbid the appearance of unescaped newlines in JSON
texts, and otherwise be just JSON sequences:

 - it's compatible with JSON sequences
 - it works with line-oriented Unix tools (e.g., wc(1), grep(1), ...)
 - aesthetically it's nice
 - it's simpler to resync: just search for the newlines (or EOF, or
offset 0) around entries that fail to parse

 - it's easy to implement because most JSON encoders I've seen (all?
I think so) have an option for producing "compact" output,
usually/always meaning no whitespace will be emitted between the
tokens that make up a JSON text -- just use this feature and that's
that

 - it even works without compact JSON encoding if you're lucky to not
have crashes and such

   Some OSes don't guarantee that writes to files will be completed
when a process is SIGKILLed.  E.g., recent Linux kernels don't
guarantee that more than one byte will be written in that case -- this
was well-intentioned in that a process could start an enormous write
that an admin might want to stop, but how would they? which is why
Linux now allows SIGKILL to terminate incomplete writes.  Therefore
power failures and system crashes are not the only thing to worry
about.

   Even with non-compact entry encodings, one can always recover with
some heuristics, and at some cost.  The biggest problem here is the
SIGKILL problem.

Nico
--