{"id":15707780,"url":"https://github.com/yozik04/influx-cleaner","last_synced_at":"2025-03-30T16:21:07.755Z","repository":{"id":149035997,"uuid":"294799895","full_name":"yozik04/influx-cleaner","owner":"yozik04","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-12T06:50:58.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T07:40:30.957Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yozik04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-11T19:52:38.000Z","updated_at":"2020-09-12T06:51:00.000Z","dependencies_parsed_at":"2023-09-02T15:48:30.148Z","dependency_job_id":null,"html_url":"https://github.com/yozik04/influx-cleaner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yozik04%2Finflux-cleaner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yozik04%2Finflux-cleaner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yozik04%2Finflux-cleaner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yozik04%2Finflux-cleaner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yozik04","download_url":"https://codeload.github.com/yozik04/influx-cleaner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246343522,"owners_count":20762054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T20:41:22.842Z","updated_at":"2025-03-30T16:21:07.709Z","avatar_url":"https://github.com/yozik04.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# influx-cleaner\nA command line tool to remove invalid data from InfluxDB.\n\nI am using some Openhab2 bindings that from time to time produce invalid data. This invalid data gets into InfluxDB. It is complicated to clean it.\n\n**WARNING:** Tool is not meant to delete a large amount of data. No deletion performance optimization is done. Index is being rebuild after every deleted row. If you have a lot of data in the MEASUREMENT it can take a lot of time to process.\n\n## Installation\nFrom Pypi\n```\npip install influx-cleaner\n```\nThis will install `influx-cleaner` command line tool to your path.\n\n## Usage in interactive mode\nRun\n```\ninflux-cleaner --host 192.168.1.2 --dbname myinfluxdb\n```\nThe tool will ask you for measurement name and query\n```\nMeasurement name(): TestMeasurement\nWHERE value \u003c -100\nDEBUG:cleaner.influx_cleaner.cleaner:Fetching: select * from TestMeasurement where value \u003c -100;\nDEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.2:8086\nDEBUG:urllib3.connectionpool:http://192.168.1.2:8086 \"GET /query?q=select+%2A+from+TestMeasurement+where+value+%3C+-100%3B\u0026db=myinfluxdb HTTP/1.1\" 200 None\nmeasurement_name        time    value\nTestMeasurement         2020-06-22T08:14:23.741000Z     -3276.8\nTestMeasurement         2020-06-22T08:29:16.077000Z     -3276.8\nTestMeasurement         2020-06-22T19:46:03.348000Z     -3276.8\nTestMeasurement         2020-09-10T21:01:44.536000Z     -3276.8\nTestMeasurement         2020-09-11T03:00:58.966000Z     -3276.8\nTestMeasurement         2020-09-11T03:01:00.886000Z     -3276.8\nremove (y/N)y\nDEBUG:urllib3.connectionpool:http://192.168.1.2:8086 \"GET /query?params=%7B%22time%22%3A+%222020-06-22T08%3A14%3A23.741000Z%22%7D\u0026q=DELETE+FROM+TestMeasurement+WHERE+time+%3D+%24time%3B\u0026db=myinfluxdb HTTP/1.1\" 200 None\nTestMeasurement   2020-06-22T08:14:23.741000Z     -3276.8 removed\nDEBUG:urllib3.connectionpool:http://192.168.1.2:8086 \"GET /query?params=%7B%22time%22%3A+%222020-06-22T08%3A29%3A16.077000Z%22%7D\u0026q=DELETE+FROM+TestMeasurement+WHERE+time+%3D+%24time%3B\u0026db=myinfluxdb HTTP/1.1\" 200 None\nTestMeasurement   2020-06-22T08:29:16.077000Z     -3276.8 removed\nDEBUG:urllib3.connectionpool:http://192.168.1.2:8086 \"GET /query?params=%7B%22time%22%3A+%222020-06-22T19%3A46%3A03.348000Z%22%7D\u0026q=DELETE+FROM+TestMeasurement+WHERE+time+%3D+%24time%3B\u0026db=myinfluxdb HTTP/1.1\" 200 None\nTestMeasurement   2020-06-22T19:46:03.348000Z     -3276.8 removed\nDEBUG:urllib3.connectionpool:http://192.168.1.2:8086 \"GET /query?params=%7B%22time%22%3A+%222020-09-10T21%3A01%3A44.536000Z%22%7D\u0026q=DELETE+FROM+TestMeasurement+WHERE+time+%3D+%24time%3B\u0026db=myinfluxdb HTTP/1.1\" 200 None\nTestMeasurement   2020-09-10T21:01:44.536000Z     -3276.8 removed\nDEBUG:urllib3.connectionpool:http://192.168.1.2:8086 \"GET /query?params=%7B%22time%22%3A+%222020-09-11T03%3A00%3A58.966000Z%22%7D\u0026q=DELETE+FROM+TestMeasurement+WHERE+time+%3D+%24time%3B\u0026db=myinfluxdb HTTP/1.1\" 200 None\nTestMeasurement   2020-09-11T03:00:58.966000Z     -3276.8 removed\nDEBUG:urllib3.connectionpool:http://192.168.1.2:8086 \"GET /query?params=%7B%22time%22%3A+%222020-09-11T03%3A01%3A00.886000Z%22%7D\u0026q=DELETE+FROM+TestMeasurement+WHERE+time+%3D+%24time%3B\u0026db=myinfluxdb HTTP/1.1\" 200 None\nTestMeasurement   2020-09-11T03:01:00.886000Z     -3276.8 removed\nRemoved 6 lines\n\n```\n\n### Arguments\n```                                                                                                                                                                                                               (master|●7…)\nusage: influx-cleaner [-h] [--host HOST] [--port PORT] [--user USER]\n                      [--password PASSWORD] [--dbname DBNAME]\n                      [--measurement MEASUREMENT] [--where WHERE] [--yes]\n\nInfluxDB Cleaner\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --host HOST           InfluxDB hostname\n  --port PORT, -p PORT  InfluxDB port\n  --user USER           InfluxDB username\n  --password PASSWORD   InfluxDB password\n  --dbname DBNAME       InfluxDB dbname\n  --measurement MEASUREMENT, -m MEASUREMENT\n                        Specify measurement\n  --where WHERE, -w WHERE\n                        Specify where query\n  --yes, -y             Say yes to all prompts\n```\n\n## Usage in scripts\n\n```bash clean.sh\n\nclean() { influx-cleaner --host 192.168.1.2 --dbname myinfluxdb -m $1 -w $2; }\n\nclean TestMeasurement \"value \u003c -100\"\nclean BogusHumidity \"value \u003c 0\"\nclean BogusTemperature \"value \u003c -100\"\n```\n\nYou can add `-y` parameter if you do not want to confirm every clean\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyozik04%2Finflux-cleaner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyozik04%2Finflux-cleaner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyozik04%2Finflux-cleaner/lists"}