[openstack-dev] Tip: jsonformatter site for parsing/debugging logs

Doug Hellmann doug at doughellmann.com
Thu Jan 21 16:27:53 UTC 2016


Excerpts from Matt Riedemann's message of 2016-01-21 10:09:32 -0600:
> Are you tired of trying to strain your eyes to parse something like this 
> in the logs [1]?
> 
> vif=VIF({'profile': {}, 'ovs_interfaceid': 
> u'ac3ca8e7-c22d-4f63-9620-ce031bf3eaac', 'preserve_on_delete': False, 
> 'network': Network({'bridge': u'br-int', 'subnets': [Subnet({'ips': 
> [FixedIP({'meta': {}, 'version': 4, 'type': u'fixed', 'floating_ips': 
> [], 'address': u'10.100.0.18'})], 'version': 4, 'meta': {u'dhcp_server': 
> u'10.100.0.17'}, 'dns': [], 'routes': [], 'cidr': u'10.100.0.16/28', 
> 'gateway': IP({'meta': {}, 'version': None, 'type': u'gateway', 
> 'address': None})})], 'meta': {u'injected': False, u'tenant_id': 
> u'1d760ac487e24e06add18dacefa221a1'}, 'id': 
> u'b13e9828-2bd9-4fb4-a20d-a92e2a8c1a77', 'label': 
> u'tempest-network-smoke--1979535575'}), 'devname': u'tapac3ca8e7-c2', 
> 'vnic_type': u'normal', 'qbh_params': None, 'meta': {}, 'details': 
> {u'port_filter': True, u'ovs_hybrid_plug': True}, 'address': 
> u'fa:16:3e:0c:d3:95', 'active': False, 'type': u'ovs', 'id': 
> u'ac3ca8e7-c22d-4f63-9620-ce031bf3eaac', 'qbg_params': None}
> 
> I found https://jsonformatter.curiousconcept.com/ which is nice since 
> you can just copy that json from the logs and paste it into the text 
> area and format it (I disable validation).

You can also do this using Python's json module from the command line:

$ echo '{"json":"obj"}' | python -m json.tool
{
  "json": "obj"
}

Doug



More information about the OpenStack-dev mailing list