# Switching emonpi/emoncms logfile locations to /var/log/emoncms

**URL:** <https://community.openenergymonitor.org/t/switching-emonpi-emoncms-logfile-locations-to-var-log-emoncms/11052>\
**Category:** emonPi\
**Created:** [29 May 2019 17:11 UTC](https://community.openenergymonitor.org/t/switching-emonpi-emoncms-logfile-locations-to-var-log-emoncms/11052 "2019-05-29T17:11:05Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![TrystanLea](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/trystanlea/32/31_2.png) [@TrystanLea](https://community.openenergymonitor.org/u/TrystanLea)\
**Post date:** [4 June 2019 17:17 UTC](https://community.openenergymonitor.org/t/switching-emonpi-emoncms-logfile-locations-to-var-log-emoncms/11052/14 "2019-06-04T17:17:23Z")

</div>

> [@TrystanLea](#):
>
> The main issue I can see is that switching to this approach right now will mean that all emoncms logs will move to the /var/log tmpfs partition and so will cease to be persistent on existing images. The main log likely to be of concern is the emonpiupdate.log which should ideally be persisted. This could be solved with a symlink, but the symlink would need to be created at system startup, probably not a big issue.

I’ve got this appraoch working, it requires the creation of the /var/log/emoncms directory in rc.local and then lower down in rc.local:

```
chown -R pi:pi /var/log/emoncms
touch /home/pi/data/emonpiupdate.log
ln -s /home/pi/data/emonpiupdate.log /var/log/emoncms/emonpiupdate.log

```

touch creates the file if it doesnt exist and leaves it be if it does.

This is only needed for older images of course and the new image rc.local is the default with no changes + log2ram handles persistance.

Once this is in place Im ready to merge the log\_location branches of emoncms and modules ready for the new script release: [emonSD next steps: filesystem & logrotate - #192 by TrystanLea](https://community.openenergymonitor.org/t/emonsd-next-steps-filesystem-logrotate/10693/192)

---

_[View the full topic](https://community.openenergymonitor.org/t/switching-emonpi-emoncms-logfile-locations-to-var-log-emoncms/11052)._
