Read counter and RSSI over MQTT

My first application and node is running and I can receive the payload data over MQTT in my openhab (or with moquitto). I would like to also read the “counter” and “rssi” fields. I can see the field names and contents:

ueli@ubuntu:~$ sudo mosquitto_sub -h eu.thethings.network -t ‘+/devices/whispernodelora1/up’ -u ‘###############’ -P ‘ttn-account-v2.###############################’ -v
###############/devices/whispernodelora1/up {“app_id”:"###############",“dev_id”:“whispernodelora1”,“hardware_serial”:“002A882A541A31B0”,“port”:1,“counter”:0,“payload_raw”:“VQ==”,“payload_fields”:{“airtemperature”:1.25,“raw”:85},“metadata”:{“time”:“2018-03-27T19:51:35.489434709Z”}}

It’s a simulated message so the RSSI is missing, but the counter is there. Extracting the payload_fields works. But if I try to extract the counter, nothing happens:

ueli@ubuntu:~$ sudo mosquitto_sub -h eu.thethings.network -t ‘+/devices/whispernodelora1/up/counter’ -u ‘###############’ -P ‘ttn-account-v2.###############################’ -v

How can I extract those two values with a simple mosquitto command?

Thanks and best regards,

The counter is part of the json formatted message. That entire message is what mosquitto receives from the publisher and provides to the subscribers, not parts of it.
If you want to extract values from the message you could use something like awk or may-be better use a small program written in python/javascript/whatever to subscribe to MQTT and process the data.

OK understood, I can do that. But how come it works for the payload date i.e. '+/devices/whispernodelora1/up/temperature’?