Log file size

waca9 years ago

Hello,

Is it possible to have a limit size of the log file ?

Thanks.

Anton Tananaev9 years ago

There are two log file (tracker-server.log and wrapper.log). Which one are you talking about? By the way, both of them roll out every day, so you can remove old files if you don't need them.

smhhadima8 years ago

how can I stop creating the log file ?

Anton Tananaev8 years ago

Remove it from the config.

smhhadima8 years ago

thank you. I have another question:
what are my options for logger.level=?
the documentation shows only 'all' option; are there any other options?

thank you

Anton Tananaev8 years ago
gonza_cid6 years ago

Is it possible to configure to automatically delete rolled out files older than x days?

Anton Tananaev6 years ago

There's no such option in Traccar, but you can always create a simple cron task to do it.

socket2 years ago

There is an example on how to automatically get rid of old logs here: https://www.traccar.org/clear-history/

However, if you want to keep logs for a longer period of time and still minimize disk usage, then logrotate is your friend. Here's how I set it up - customize it to your own needs:

  • logrotate file for traccar tracker-server.log:
/opt/traccar/logs/tracker-server.log {
  rotate 52
  size 1G
  weekly
  compress
  notifempty
  lastaction
    systemctl restart traccar
  endscript
}
  • you also need to disable the log rotation that is done by traccar by default. To do so add this to your traccar.xml - the last line is the important one:
    <entry key='logger.enable'>true</entry>
    <entry key='logger.level'>info</entry>
    <entry key='logger.file'>./logs/tracker-server.log</entry>
    <entry key='logger.rotate'>false</entry>

One wish list item I have for this - or maybe there is a way already: force traccar to close and re-create the log file without a full restart.
Similar to how it is described here: https://github.com/log4js-node/log4js-node/issues/343
Currently sending HUP signal fully restarts traccar.

Anton Tananaev2 years ago

Feel free to create a ticket or send a pull request.

socket2 years ago
John Smitha year ago

@socket that was a big help to clear log files after 30 days. I looked at the db clearing (mine is 2GB+), but my server is using H2 DB. Any ideas on that? I think I tried doing a vacuum on it with little success, and had chatted with Anton a bit. If not, any way to convert to Mysql? (mostly how would I export all vehicles, geofences, and notifications? Thanks

Anton Tananaeva year ago

There are some threads on the forum about converting H2 to MySQL. I think someone even posted a step by step guide for it.

John Smitha year ago

Thanks Anton. Is there a way to export my main configuration data and just start fresh by importing?

Anton Tananaeva year ago

What do you mean by main configuration?