Inserting values via telnet interface, datestamp issues..
gclair opened this issue · 2 comments
Trying to get data from rtlamr data (water meter consumption data) into Akumuli, but I don't think I have the date/timestamp correct. Whats the preferred or proper way to do it? I thought ISO8601 was valid?
$ ~/go/bin/rtlamr -msgtype=scm+ -format=json -agcmode=true 2>/dev/null | jq -r '"put consumption \(now | todateiso8601) \(.Message.Consumption) protocolID=\(.Message.ProtocolID) endpointType=\(.Message.EndpointType) endpointID=\(.Message.EndpointID) endpointTamper=\(.Message.Tamper)"' | nc localhost 4242
Where the output looks like:
`put consumption 2019-05-28T22:16:25Z 287517 protocolID=30 endpointType=203 endpointID=79596963 endpointTamper=2304
put consumption 2019-05-28T22:16:26Z 88821 protocolID=30 endpointType=203 endpointID=79728434 endpointTamper=18688
put consumption 2019-05-28T22:16:59Z 32302 protocolID=30 endpointType=203 endpointID=79599192 endpointTamper=18688
put consumption 2019-05-28T22:17:03Z 54908 protocolID=30 endpointType=203 endpointID=79604315 endpointTamper=18688
put consumption 2019-05-28T22:17:23Z 24389 protocolID=30 endpointType=203 endpointID=79729560 endpointTamper=18688
put consumption 2019-05-28T22:18:00Z 32302 protocolID=30 endpointType=203 endpointID=79599192 endpointTamper=18688
put consumption 2019-05-28T22:18:21Z 13343 protocolID=30 endpointType=203 endpointID=79593215 endpointTamper=26880
put consumption 2019-05-28T22:19:03Z 54908 protocolID=30 endpointType=203 endpointID=79604315 endpointTamper=18688
put consumption 2019-05-28T22:19:25Z 287517 protocolID=30 endpointType=203 endpointID=79596963 endpointTamper=2304
put consumption 2019-05-28T22:19:57Z 27160 protocolID=30 endpointType=203 endpointID=79728436 endpointTamper=18688
put consumption 2019-05-28T22:20:00Z 32302 protocolID=30 endpointType=203 endpointID=79599192 endpointTamper=18688
put consumption 2019-05-28T22:20:15Z 43835 protocolID=30 endpointType=203 endpointID=79596719 endpointTamper=18688
put consumption 2019-05-28T22:20:23Z 24389 protocolID=30 endpointType=203 endpointID=79729560 endpointTamper=18688
put consumption 2019-05-28T22:20:25Z 287517 protocolID=30 endpointType=203 endpointID=79596963 endpointTamper=2304
put consumption 2019-05-28T22:20:26Z 88821 protocolID=30 endpointType=203 endpointID=79728434 endpointTamper=18688`
Hi,
Currently, only basic ISO8061 timestamps are supported. https://docs.akumuli.org/writing-data#timestamp Using jq it will be something like this:
now | mktime | strftime("%Y%m%dT%H%M%S")
Another possible option is to send nanosecond unix-timestamp.
Yeah I ended up converting to epoch with this from jq -
"\(now | todateiso8601 | strptime("%Y-%m-%dT%H:%M:%SZ") | mktime )"
Thanks!