Juniper / jtimon

Junos Telemetry Interface (JTI) client
Apache License 2.0
31 stars 10 forks source link

when json output is configured, print in json format #57

Closed amohit1315 closed 3 weeks ago

amohit1315 commented 3 weeks ago

when json output is configured, print in json format

50

chagantvj commented 2 weeks ago

./jtimon-linux-amd64-latest --version 2024/10/29 19:18:27 Version: v2.0.4-75d77de34e28e98d742c102ea530504432eec489-master BuildTime 2024-10-29T16:52:08+0530

Usage: ./jtimon-linux-amd64-latest --config Ngpr-brackla-1-grpc-auth_log.json --no-per-packet-goroutines --json

  {
    "elems": [
      "state", <---- this should be printed as state/text as these two elements are not at same level.
      "text"
    ],
    "key": "string_val",
    "value": "Static Mpls lsp(280) usage requires a license"
  },
  {
    "elems": [
      "state", <---- like "state/time-created"
      "time-created"
    ],
    "key": "uint_val",
    "value": "1730229150000000000"
  },
  {
    "elems": [
      "state",
      "severity"
    ],
    "key": "string_val",
    "value": "MINOR"
  },
  {
    "elems": [
      "state",
      "type-id"
    ],
    "key": "string_val",
    "value": "License"
  }
]

},

------------------- OUTPUT -------------

{ "component": "re0/alarmd", "component_id": "65535", "export_timestamp": "1730229390350", "notification": { "del_paths": null, "prefix": "/system/alarms/alarm", "timestamp": 1730229390350469769, "updates": [ { "elems": [ "state", "resource" ], "key": "string_val", "value": "SYSTEM" }, { "elems": [ "state", "text" ], "key": "string_val", "value": "2960 Port Bandwidth Usage (in gbps)s(279) require a license" }, { "elems": [ "state", "time-created" ], "key": "uint_val", "value": "1730229390000000000" }, { "elems": [ "state", "severity" ], "key": "string_val", "value": "MINOR" }, { "elems": [ "state", "type-id" ], "key": "string_val", "value": "License" } ] }, "sensor_name": "sensor_1038", "sequence_number": "104155", "streamed_path": "/system/alarms/", "subscribed_path": "/system/alarms/", "system_id": "ngpr-brackla-1a" } { "component": "re0/alarmd", "component_id": "65535", "export_timestamp": "1730229390350", "notification": { "del_paths": null, "prefix": "/system/alarms/alarm", "timestamp": 1730229390350712985, "updates": [ { "elems": [ "state", "resource" ], "key": "string_val", "value": "SYSTEM" }, { "elems": [ "state", "text" ], "key": "string_val", "value": "Static Mpls lsp(280) usage requires a license" }, { "elems": [ "state", "time-created" ], "key": "uint_val", "value": "1730229330000000000" }, { "elems": [ "state", "severity" ], "key": "string_val", "value": "MINOR" }, { "elems": [ "state", "type-id" ], "key": "string_val", "value": "License" } ] }, "sensor_name": "sensor_1038", "sequence_number": "104156", "streamed_path": "/system/alarms/", "subscribed_path": "/system/alarms/", "system_id": "ngpr-brackla-1a" } { "component": "re0/alarmd", "component_id": "65535", "export_timestamp": "1730229390351", "notification": { "del_paths": null, "prefix": "/system/alarms/alarm", "timestamp": 1730229390350908698, "updates": [ { "elems": [ "state", "resource" ], "key": "string_val", "value": "SYSTEM" }, { "elems": [ "state", "text" ], "key": "string_val", "value": "Static Mpls lsp(280) usage requires a license" }, { "elems": [ "state", "time-created" ], "key": "uint_val", "value": "1730229390000000000" }, { "elems": [ "state", "severity" ], "key": "string_val", "value": "MINOR" }, { "elems": [ "state", "type-id" ], "key": "string_val", "value": "License" } ] }, "sensor_name": "sensor_1038", "sequence_number": "104157", "streamed_path": "/system/alarms/", "subscribed_path": "/system/alarms/", "system_id": "ngpr-brackla-1a" }