Logging to a local server
It may happen you do not want to log to https://2minlog.com service, but you prefer to log to your local system - e.g., your dedicated lab server, laptop, Raspberry Pi, or a NAS system. In this case, you do not have to use the 2minlog system, but we have prepared a simple server, which will produce exactly the same csv file as you would get after downloading from the 2minlog service.
Here is the source code.
- No need to install any additional packages
- Just run
python server.py
- You may adjust the HOSTNAME and PORT if you prefer
Here are two examples of logging:
curl "http://localhost:8000?datasetSecret=SEC-d811574a-b61e-4844-b61b-e06da34c6ef7&temperature=451&humidity=80"
curl -X POST --user "2minlog:SEC-d811574a-b61e-4844-b61b-e06da34c6ef7" http://localhost:8000/ -d "{\"temperature\":\"451\", \"humidity\":\"8017x1\"}"
Both examples work in Windows command.com and Linux shell.
The format above is compatible with 2minlog, while it logs all the data into one file. Therefore, it does not use Dataset Public/Private keys, so they can be omitted.