Jack Yaz
Part of the Furniture
I personally hope that the Entware team provide vnstat v2 as I can plug sqlite into chartjs and give this project some great interactive charts.The output of --oneline, --json or --xml isn't intended to be imported back. If you need to move the version 1.x database around between architectures then --exportdb and --importdb are there for that. In version 2.x it's possible to move the database file directly as sqlite handles the format while version 1.x database stops working if the endianness or architecture bit width changes.
The situations when you'd want to use --oneline, --json or --xml is when you are trying to pull out some single measurement or a limited series from the database. These output allow you to get access to the values directly without having to parse the text formatted output. As an example, I found this from db-vnstat.sh:
$VNSTAT_COMMAND -m | tail -n 3 | head -n 1 | cut -d "|" -f3 | awk '{print $1}'
while it could be replaced with
$VNSTAT_COMMAND --oneline b | cut -d\; -f11
and you wouldn't even need to worry about running the command again since that drops the unit and provides the result directly in bytes. 2 commands executed instead of 10.
PS. When the daemon ("vnstatd") is running in the background, there shouldn't be a need to run "vnstat -u". When that combination is executed, the "vnstat -u" command ends up rewriting the database file based on the limit visibility it has on the current situation. Meanwhile, the daemon still stays running in the background with a cached copy of the database and will eventually overwrite the database with that cached and updated copy based on the longer duration changes it has seen. "vnstat -u" was removed from the 2.x versions to avoid this to even happen while in 1.x versions it can cause some confusing result as the database gets overwritten with cached data after a while.
Thanks for clarification re use of -u and - -oneline, much cleaner. I wasn't familiar with how to use vnstat so was provided with the commands from others closer to the tool. Your input is very valued!