Skip to content

Main content

Log Record Adjacent Message Groups

Compact adjacent identical log source/level/message observations with count and time-envelope evidence, preserving adjacency rather than globally deduplicating.

Loading tool…

Description

Compact adjacent identical log source/level/message observations with count and time-envelope evidence, preserving adjacency rather than globally deduplicating.

Structured log records need an explicit ordering, time unit and label convention. A sequence gap can be measured in supplied record order without proving loss, and grouping adjacent messages differs from grouping all equal messages. The record tools here operate on caller-supplied structured data rather than collecting logs.

Compact adjacent identical log source/level/message observations with count and time-envelope evidence, preserving adjacency rather than globally deduplicating.

When to use this tool

Use this tool to compact adjacent identical log source/level/message observations with count and time-envelope evidence, preserving adjacency rather than globally deduplicating.

How to use the tool and how it works

  1. Enter recordsJson using the field definitions below. For JSON text, serialize the explicit records in the shown shape.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.groups. Use the ordering, boundary rules and absence conditions described below.

Group adjacent records whose source, level and message strings are exactly equal. Return run spans, counts and stored endpoint times.1

Input fieldMeaning and unitsAccepted input
recordsJsonJSON array of {id, time, source, level, message, sequence} records. Time and gap units are caller-defined; sequence is a nonnegative integer.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.

These are the decoded structures used in the example’s JSON text fields. Supply the corresponding serialized JSON strings as input.

json
{
  "recordsJson": [
    {
      "id": "a",
      "time": 1,
      "source": "s",
      "level": "info",
      "message": "x",
      "sequence": 1
    },
    {
      "id": "b",
      "time": 3,
      "source": "s",
      "level": "info",
      "message": "x",
      "sequence": 3
    }
  ]
}
Output fieldInterpretation
resultObject containing the named fields below.
result.groupsAdjacent equal source/level/message runs with counts and stored endpoint times.
json
{
  "input": {
    "recordsJson": "[{\"id\": \"a\", \"time\": 1, \"source\": \"s\", \"level\": \"info\", \"message\": \"x\", \"sequence\": 1}, {\"id\": \"b\", \"time\": 3, \"source\": \"s\", \"level\": \"info\", \"message\": \"x\", \"sequence\": 3}]"
  },
  "output": {
    "result": {
      "groups": [
        {
          "start": 0,
          "end": 2,
          "source": "s",
          "level": "info",
          "message": "x",
          "count": 2,
          "firstTime": 1,
          "lastTime": 3
        }
      ]
    }
  }
}

Limitations and assumptions

  • Different aliases are not normalized here, and nonadjacent equal records do not merge.
  • Structured log records have id, time, source, level, message and sequence fields. time is a finite caller-defined numeric scale; sequence is an integer from 0 through 1,000,000,000,000. Use the same time units for windows and gap edges.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Keep original record order and provenance alongside summaries. Sort, partition by source or normalize aliases explicitly before applying a rule that depends on those choices.

References

  1. Tool behavior and example: Log Record Adjacent Message Groups — tool.io

Similar or alternative tools

  • Log Level Order Selector

    Select supplied severity tokens at or above an explicit least-to-most ordered level bank; retain unknown tokens instead of assuming rank.

  • Log Level Token Normalizer

    Normalize a log-level token through explicit caller aliases with cycle/path evidence; no universal severity vocabulary.