Is it possible to delete servers history for a device?

mikekgr7 years ago

Dear Sirs,
I am using the latest traccar server and I am looking for an easy way to delete the history for one or more devices. Is this a feature that Web interface support or I need other way? Please be specific because I am not experienced in this field...

Thanks and Best Regards,
Mike Kranidis

Anton Tananaev7 years ago

No, the only way to delete data for some subset of devices is directly through the database.

mikekgr7 years ago

Thanks

imarinkovic7 years ago

Sorry for bringing this up again, but when I try to delete an old device with a lot of history, the following error came on screen:

Communications link failure

The last packet successfully received from the server was 15,923 milliseconds ago.  The last packet sent successfully to the server was 15,923 milliseconds ago. - CommunicationsException (... < QueryBuilder:475 < DataManager:229 < DeviceManager:230 < ...)

Obviously is a timeout problem, Can be managed via Traccar?

Best regards,
Ivan

Anton Tananaev7 years ago

You should increase MySQL server timeout. There is nothing Traccar can do about it.

imarinkovic7 years ago

Ok Anton, thanks for answering.

imarinkovic7 years ago

For all to know, the problem about "Communications link failure" was triggered for problems with server memory capacity. Deleting a large set of data made mysql OOM-killed. Installed more memory and problem disappeared.

Thanks Anton for this awesome work.

Dariusz4 years ago
delete FROM tc_positions where  servertime < now() - interval 8 DAY and (deviceid = 155 or deviceid = 64 or deviceid = 79 or deviceid = 99) 
Dariusz4 years ago

any idea for delete history older for GroupID ?

tc_groups.groupid = 3
Dariusz4 years ago
tc_positions.deviceid = tc.devices.id WHERE tc_devices.groupid = 3
Dariusz4 years ago
delete tc_positions.* FROM `tc_positions` LEFT JOIN tc_devices ON  deviceid = tc_devices.id  WHERE groupid = 28 and servertime < now() - interval 1 DAY

works like I want :)

Vani3 years ago

Where do i need to place this code? delete tc_positions.* FROM tc_positions LEFT JOIN tc_devices ON deviceid = tc_devices.id WHERE groupid = 28 and servertime < now() - interval 1 DAY

Dariusz3 years ago

I'm using phpmyadmin site ....