zmoog / toggl-track

Toggl Track CLI
Apache License 2.0
0 stars 1 forks source link

Document how to export time entries from Toggl to Elasticsearch #13

Closed zmoog closed 1 year ago

zmoog commented 1 year ago
$ tgl --format ndjson entries list --start-date 2023-02-20 --end-date 2023-02-27 > 2023-w08.ndjson

$ cat 2023-w08.ndjson | head -n 1 | jq
{
  "id": 2861310160,
  "workspace_id": 1815018,
  "user_id": 2621333,
  "project_id": 178435728,
  "task_id": null,
  "billable": false,
  "at": "2023-02-26T22:26:48+00:00",
  "description": "Elastic Observability Engineer (On-Demand)",
  "start": "2023-02-26T20:53:04+00:00",
  "stop": "2023-02-26T22:26:48+00:00",
  "duration": 5624,
  "tags": [
    "type:hr"
  ]
}
zmoog commented 1 year ago

Here's how to manually load the .ndjson file into Elasticsearch:

Export the week's time entries from Monday (included) to Monday (excluded):

tgl --format ndjson entries list --start-date 2023-02-06 --end-date 2023-02-13 > 2023-w06.json

Then:

The tool will create the new index and import the data according to settings.

https://user-images.githubusercontent.com/25941/222286733-c71d4eed-9f4a-4bbb-a381-05722fc60c18.mp4