# How to create daily storagenode logs

**URL:** <https://forum.storj.io/t/how-to-create-daily-storagenode-logs/6199>\
**Category:** FAQ\
**Tags:** log-rotate\
**Created:** [April 25, 2020, 8:21pm UTC](https://forum.storj.io/t/how-to-create-daily-storagenode-logs/6199 "2020-04-25T20:21:47Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![S0litiare](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/s0litiare/32/65_2.png) [@S0litiare](https://forum.storj.io/u/S0litiare)\
**Post date:** [April 25, 2020, 10:20pm UTC](https://forum.storj.io/t/how-to-create-daily-storagenode-logs/6199/5 "2020-04-25T22:20:42Z")

</div>

are you running in a NAS or Windows or Linux?

In Ubuntu I use the “logrotate” command in a cron job to create/compress log files.

First you have to make sure you have added in the “Log Location” and “Log level” fields in the “config.yaml”

Then look in the “/etc/logrotate.d/” folder, you’ll see a list of files, those are the configs used to rotate logfiles ( usually found in “/var/log/”). I just put a “storj” config file in the logrotate.d/ and it’s done automatically

To rotate my logs i use the following config file (edit it to your requirements!):

```
/mnt/node/node.log {

    rotate 14
    daily
    copytruncate
    compress
    missingok
    notifempty
}

```

Explanation:

First line is the location of the log file you wish to rotate

roatate 14 = keep the past 14 log files  
daily = frequency in which to create a new log (can be : hourly, daily, weekly, monthly, yearly)  
copytruncate = copy log before compressing, and empty the log file contents (used when programs can’t be start/stopped easily)  
compress = compress the log file  
missingok = do not throw an error of their is no log file  
notifempty = do not rotate log file if it’s empty

This will rotate the log every midnight and compress and keep the past 14 days worth of logs.

Read more here:  
[https://www.thegeekstuff.com/2010/07/logrotate-examples/](https://www.thegeekstuff.com/2010/07/logrotate-examples/)  
or have a read through the logrotate man files.

---

_[View the full topic](https://forum.storj.io/t/how-to-create-daily-storagenode-logs/6199)._
