Changeset 11190 in ntrip for trunk/BNC


Ignore:
Timestamp:
Nov 10, 2026, 9:21:30 AM (7 hours ago)
Author:
stuerze
Message:

Structured logging improved

Location:
trunk/BNC
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/CHANGELOG.md

    r11189 r11190  
    11# Changelog
    22## 2.13.8 (2026-11-04)
    3 - ADDED: **Structured logfile** (General options 'Structured logfile', 'Format' and 'Min. level', keys logFileStructured, logFormatStructured and logLevelStructured): in addition to the unchanged logfile, the same records as JSON Lines ('json', default) or key=value pairs ('logfmt'), one appended file without date for rotation by logrotate & co (reopened if moved or removed); each record has the time in UTC ('time'), for records of a data epoch its GPS Time ('epoch'), level, component, event, mountpoint ('mp'), the event's fields, the logfile text ('msg', without the leading mountpoint and shortened where the fields carry the details, e.g. 'PPP position') and a version ('v'). Events with fields: ppp_position, ppp_epoch_failed, stream_format, stream_content (RTCM scan, with message_type and size of the received message types), stream_timeout, stream_outage_begin/end, stream_corrupted_begin/end, stream_latency; all other messages as event 'message' with the component of their origin (stream, ntrip, bce, ssr, ppp, cmb, upload, ssrqc, bnc) and a level (error: a function does not work; warning: data or configuration problem, BNC continues; info: status); messages of the BNC_DEBUG_BCE/OBS/CMB defines with level 'debug' and component bce/obs/cmb. Test case log_structured and check tests/tools/logcheck.py
     3- ADDED: **Structured logfile** (General options 'Structured logfile', 'Format' and 'Min. level', keys logFileStructured, logFormatStructured and logLevelStructured): in addition to the unchanged logfile, the same records as JSON Lines ('json', default) or key=value pairs ('logfmt'), one appended file without date for rotation by logrotate & co (reopened if moved or removed); each record has the time in UTC ('time'), for records of a data epoch its GPS Time ('epoch'), level, component, event, mountpoint ('mp'), the event's fields, the logfile text ('msg', without the leading mountpoint and trailing blanks, shortened where the fields carry the details, e.g. 'PPP position') and a version ('v'). Events with fields: ppp_position, ppp_epoch_failed, stream_format, stream_content (RTCM scan, with message_type and size of the received message types), stream_timeout, stream_outage_begin/end, stream_corrupted_begin/end, stream_latency; all other messages as event 'message' with the component of their origin (stream, ntrip, bce, ssr, ppp, cmb, upload, ssrqc, bnc) and a level (error: a function does not work; warning: data or configuration problem, BNC continues; info: status); messages of the BNC_DEBUG_BCE/OBS/CMB defines with level 'debug' and component bce/obs/cmb. Test case log_structured and check tests/tools/logcheck.py
    44- FIXED: Build with BNC_DEBUG_BCE: undeclared message number in the debug messages of the Galileo ephemeris decoder
    55- ADDED: **epoch/velocity fields to PPP coordinates file to allow BNC to propagate the reference coordinates** related to a dedicated reference epoch to the current processing epoch internally; coordinates can also be given as latitude/longitude/height
  • trunk/BNC/src/bncgetthread.cpp

    r11187 r11190  
    840840        t_logRecord rec(t_logRecord::info, "stream", "stream_content", _staID,
    841841                        _staID + ": Received message type " + type.toLatin1() +  size.toLatin1());
    842         rec.setStructuredMsg("Received message");
     842        rec.setStructuredMsg("Received RTCM message");
    843843        rec.add("message_type", int(decoder()->_typeList[ii]._type));
    844844        if (decoder()->_typeList[ii]._size) {
  • trunk/BNC/src/bnchelp.html

    r11189 r11190  
    28182818    <li>'mp': the mountpoint of the stream or the PPP station, if known,</li>
    28192819    <li>the fields of the event,</li>
    2820     <li>'msg': the text of the record in the logfile, without the leading mountpoint ('&lt;mp&gt;: ') and shortened
    2821         for events whose fields carry the details: 'PPP position' (ppp_position), 'Received message' (message types
    2822         of the RTCM scan), 'Mean latency' (stream_latency), 'Failure threshold exceeded, outage' / 'corrupted' and
     2820    <li>'msg': the text of the record in the logfile, without the leading mountpoint ('&lt;mp&gt;: ') and trailing blanks, shortened
     2821        for events whose fields carry the details: 'PPP position' (ppp_position), 'Received RTCM message' (message types
     2822        of the RTCM scan), 'Latency' (stream_latency), 'Failure threshold exceeded, outage' / 'corrupted' and
    28232823        'Recovery threshold exceeded, outage ended' / 'corruption ended' (stream_outage_*, stream_corrupted_*),</li>
    28242824    <li>'v': the version of the record layout, currently 1.</li>
  • trunk/BNC/src/bnclog.cpp

    r11189 r11190  
    275275    msg.remove(0, _stream.size() + 2);
    276276  }
     277  // no trailing blanks (e.g. RTCM scan: "Receiver Serial Number: 1831551 ")
     278  while (msg.endsWith(' ')) {
     279    msg.chop(1);
     280  }
    277281
    278282  QVector<t_field> all;
  • trunk/BNC/src/latencychecker.cpp

    r11189 r11190  
    567567  }
    568568  t_logRecord rec(t_logRecord::info, "stream", "stream_latency", _staID, text.toLatin1());
    569   rec.setStructuredMsg("Mean latency");
     569  rec.setStructuredMsg("Latency");
    570570  rec.add("type", l._type)
    571571     .add("mean", mean, 2)
  • trunk/BNC/tests/tools/logcheck.py

    r11189 r11190  
    99'epoch' after 'time', GPS Time without 'Z'), that the records belong line by
    1010line to the classic logfile ('msg' is the classic text without the "<mp>: "
    11 prefix, shortened for events whose fields carry the details, see matches();
     11prefix and trailing blanks, shortened for events whose fields carry the details, see matches();
    1212classic lines without their "yy-mm-dd hh:mm:ss " prefix; the start line is
    1313skipped, it goes to the file of the current date) and that 'time' (UTC) is the
    … …  
    7777}
    7878
     79SHORT_MSG = {"ppp_position": "PPP position", "stream_latency": "Latency"}
     80
    7981
    8082def matches(r, line):
    … …  
    8486    mp, msg, ev = r.get("mp"), r.get("msg"), r.get("event")
    8587    if ev in SHORT:
    86         return line.startswith(SHORT[ev](r))
     88        return msg == SHORT_MSG[ev] and line.startswith(SHORT[ev](r))
    8789    if ev == "stream_content" and "message_type" in r:
    8890        size = " (size %d)" % r["size"] if "size" in r else " "
    89         return msg == "Received message" and \
     91        return msg == "Received RTCM message" and \
    9092            line == "%s: Received message type %d%s" % (mp, r["message_type"], size)
    9193    if mp and line.startswith(mp + ": "):
    9294        line = line[len(mp) + 2:]
     95    line = line.rstrip(" ")
    9396    if ev.startswith("stream_outage_") or ev.startswith("stream_corrupted_"):
    9497        return line.startswith(msg + " ")
Note: See TracChangeset for help on using the changeset viewer.