*New 11.3 series Release:
2019-10-19: XigmaNAS 11.3.0.4.7014 - released

*New 12.0 series Release:
2019-10-05: XigmaNAS 12.0.0.4.6928 - released!

*New 11.2 series Release:
2019-09-23: XigmaNAS 11.2.0.4.6881 - released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

How to move ups.log and utx.log to another location?

XigmaNAS Basic Tune-up
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
User avatar
Snufkin
Advanced User
Advanced User
Posts: 289
Joined: 01 Jul 2012 11:27
Location: Etc/GMT-3 (BSD style)
Status: Offline

How to move ups.log and utx.log to another location?

#1

Post by Snufkin » 07 Jan 2017 22:20

Successfully moved (see WiKi NAS4Free) most of the log files from /var/log/ to /mnt/<gmirrow RAID>.
Only 3 files remained in /var/log/
  • ups.log
  • utx.lastlogin
  • utx.log
Their sizes are small, even ups.log grows every day by 12 kB only (1 record per 5 min).
My concern is constant updates of these files and writes to USB flash drive with embedded NAS4Free installation.

Are there any 'hidden' variables which I could insert in rc.conf WebUI and put above files with the rest of logs?
XNAS 11.3.0.4 embedded, ASUS P5B-E, Intel DC E6600, 4 GB DDR2, 2 x HGST HDN726040ALE614, 2 x WDC WD5000AAKS, Ippon Back Power Pro 400

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4925
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: How to move ups.log and utx.log to another location?

#2

Post by raulfg3 » 07 Jan 2017 22:56

revise NUT documentation, perhaps some auxiliary parameter can be set to define new location for log:

http://wiki.nas4free.org/doku.php?id=do ... rvices_ups

http://networkupstools.org/documentation.html

http://networkupstools.org/docs/man/upslog.html


and try nut_logfile= yourlogpath, work for me for other services like mlnet:
1.jpg
You do not have the required permissions to view the files attached to this post.
12.0.0.4 (revision 6766)+OBI on SUPERMICRO X8SIL-F 8GB of ECC RAM, 12x3TB disk in 3 vdev in RaidZ1 = 32TB Raw size only 22TB usable

Wiki
Last changes

User avatar
Snufkin
Advanced User
Advanced User
Posts: 289
Joined: 01 Jul 2012 11:27
Location: Etc/GMT-3 (BSD style)
Status: Offline

Re: How to move ups.log and utx.log to another location?

#3

Post by Snufkin » 08 Jan 2017 12:32

Thank you, raulfg3 for the prompt reply.
Carefully studied all the links and found no obvious way to specify new path for log files.

According to upslog man pages log file path and name are specified among other command-line options.
And I can see it in process list

Code: Select all

/usr/local/bin/upslog -s Ippon@localhost -l /var/log/ups.log -i 300 -u root
Attempt to guess variable name failed, definition of variables nut_logfile (and just in case ups_logfile) doesn't change path and name in upslog command line option.

Assume the answer to my question required changes in the N4F code.
XNAS 11.3.0.4 embedded, ASUS P5B-E, Intel DC E6600, 4 GB DDR2, 2 x HGST HDN726040ALE614, 2 x WDC WD5000AAKS, Ippon Back Power Pro 400

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4925
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: How to move ups.log and utx.log to another location?

#4

Post by raulfg3 » 08 Jan 2017 12:52

sorry, but you are right.
12.0.0.4 (revision 6766)+OBI on SUPERMICRO X8SIL-F 8GB of ECC RAM, 12x3TB disk in 3 vdev in RaidZ1 = 32TB Raw size only 22TB usable

Wiki
Last changes

User avatar
crest
Hardware & Software Guru
Hardware & Software Guru
Posts: 873
Joined: 02 Jul 2012 22:25
Location: Vienna, Austria - GMT+1
Status: Offline

Re: How to move ups.log and utx.log to another location?

#5

Post by crest » 13 Jan 2017 09:14

Hello Snufkin,
Snufkin wrote:
08 Jan 2017 12:32
Thank you, raulfg3 for the prompt reply.
Carefully studied all the links and found no obvious way to specify new path for log files.

According to upslog man pages log file path and name are specified among other command-line options.
And I can see it in process list

Code: Select all

/usr/local/bin/upslog -s Ippon@localhost -l /var/log/ups.log -i 300 -u root
Attempt to guess variable name failed, definition of variables nut_logfile (and just in case ups_logfile) doesn't change path and name in upslog command line option.

Assume the answer to my question required changes in the N4F code.

You could try the new beta release of Extended GUI => viewtopic.php?f=71&t=6405&p=74622#p74622 which allows to include user defined logs (an example for the UPS log is included and ready for use).

Regards
crest
NAS1: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI 760GM-P23; AMD Athlon(tm) II X2 250 7.58GiB RAM
NAS2: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI MS-7369; AMD Sempron(tm) LE-1250 8022MiB RAM
UPS: APC Back-UPS ES 550G
Extensions: OneButtonInstaller, Extended GUI, NextOwnCloud, BitTorrent Sync, Syncthing, Downloady, Midnight Commander, NCDU, MySQL, Rclone, Themes:

User avatar
Snufkin
Advanced User
Advanced User
Posts: 289
Joined: 01 Jul 2012 11:27
Location: Etc/GMT-3 (BSD style)
Status: Offline

Re: How to move ups.log and utx.log to another location?

#6

Post by Snufkin » 15 Jan 2017 12:57

crest wrote:
13 Jan 2017 09:14
You could try the new beta release of Extended GUI => viewtopic.php?f=71&t=6405&p=74622#p74622 which allows to include user defined logs (an example for the UPS log is included and ready for use).
Thank you crest, for good advice, Extended GUI is simple and straightforward way to make my own permanent log files based on temporary system files.
My original idea was to move files from temporary location in two hypothetical cases:
  • reduce size of temporary in-memory file system and get free extra RAM,
  • move constantly updated files from flash to rotational disks.
And, as I understand it, N4F still lacks feature to reassign the storage location of ALL log files using ONE global variable.
XNAS 11.3.0.4 embedded, ASUS P5B-E, Intel DC E6600, 4 GB DDR2, 2 x HGST HDN726040ALE614, 2 x WDC WD5000AAKS, Ippon Back Power Pro 400

User avatar
crest
Hardware & Software Guru
Hardware & Software Guru
Posts: 873
Joined: 02 Jul 2012 22:25
Location: Vienna, Austria - GMT+1
Status: Offline

Re: How to move ups.log and utx.log to another location?

#7

Post by crest » 17 Jan 2017 08:58

Hello Snufkin,

Snufkin wrote:
15 Jan 2017 12:57
crest wrote:
13 Jan 2017 09:14
You could try the new beta release of Extended GUI => viewtopic.php?f=71&t=6405&p=74622#p74622 which allows to include user defined logs (an example for the UPS log is included and ready for use).
Thank you crest, for good advice, Extended GUI is simple and straightforward way to make my own permanent log files based on temporary system files.
My original idea was to move files from temporary location in two hypothetical cases:
  • reduce size of temporary in-memory file system and get free extra RAM,
  • move constantly updated files from flash to rotational disks.

Ok, I dug a little bit in the sources and the solution is quite simple (but only for the UPS log unfortunately).
Open System > Advanced > rc.conf in the WebGUI and add a new variable

Code: Select all

name: nut_upslog_logfile
value: /mnt/YourDirectoryPath/ups.log

hit Save and Apply Changes and restart upslog in the CLI with

Code: Select all

/etc/rc.d/nut_upslog restart

You should get a similar output like this:

Code: Select all

Stopping nut_upslog.
Waiting for PIDS: 60741.
Starting nut_upslog.
Network UPS Tools upslog 2.7.4
logging status of UPS@localhost to /mnt/DATA/ups-testlog.log (300s intervals)

If you want to see the output in Diagnostics > Log just modify the user defined log file which is provided with the above mentioned beta of Extended GUI according to the value you used for the nut_upslog_logfile.

Unfortunately the described solution is not possible for the utx logs because their the path /var/log is hardcoded in the file /etc/rc.d/proftpd so if you want to change the path too than you must patch the file accordingly and restart proftpd as well. The bad thing here is that, if you use embedded installation, you must copy a patched file from a persistant location to /etc/rc.d/proftpd and restart proftpd with a postinit command which you can do in System > Advanced > Command Scripts

And, as I understand it, N4F still lacks feature to reassign the storage location of ALL log files using ONE global variable.

Thats not (totally ;) ) true, there is a global variable clog_logdir you can use in System > Advanced > rc.conf BUT, for some reasons - I suppose the idea was somehow a diffence between the file types "type" => "clog" and "type" => "plain", it is not used for all provided logs, as defined in /usr/local/www/diag_log.inc

Code: Select all

// Get the location of the log files (may be modified via rc.conf variables).
$clogdir = rc_getenv_ex("clog_logdir", $g['varlog_path']);
$rsync_client_logfile = rc_getenv_ex("rsync_client_logfile", "{$g['varlog_path']}/rsync_client.log");
$rsync_local_logfile = rc_getenv_ex("rsync_local_logfile", "{$g['varlog_path']}/rsync_local.log");
$fuppes_logfile = rc_getenv_ex("fuppes_logfile", "{$g['varlog_path']}/fuppes.log");
$minidlna_logdir = rc_getenv_ex("minidlna_logdir", "{$g['varlog_path']}");
$minidlna_logfile = "$minidlna_logdir/minidlna.log";
$mtdaapd_logfile = rc_getenv_ex("mtdaapd_logfile", "{$g['varlog_path']}/mt-daapd.log");
$proftpd_modban_logfile = rc_getenv_ex("proftpd_modban_banlog", "{$g['varlog_path']}/proftpd/ban.log");

IMHO it would be more consistent to change the initial values from e.g.

Code: Select all

$rsync_client_logfile = rc_getenv_ex("rsync_client_logfile", "{$g['varlog_path']}/rsync_client.log");

to

Code: Select all

$rsync_client_logfile = rc_getenv_ex("rsync_client_logfile", "{$clogdir}/rsync_client.log");

because if one uses the global variable clog_logdir than this would be used also for
$rsync_client_logfile, $rsync_local_logfile, $fuppes_logfile, $minidlna_logdir etc. as default.
But it is up to the devs to change the logic ...

I hope this helps a bit ;)

Regards
crest
NAS1: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI 760GM-P23; AMD Athlon(tm) II X2 250 7.58GiB RAM
NAS2: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI MS-7369; AMD Sempron(tm) LE-1250 8022MiB RAM
UPS: APC Back-UPS ES 550G
Extensions: OneButtonInstaller, Extended GUI, NextOwnCloud, BitTorrent Sync, Syncthing, Downloady, Midnight Commander, NCDU, MySQL, Rclone, Themes:

User avatar
Snufkin
Advanced User
Advanced User
Posts: 289
Joined: 01 Jul 2012 11:27
Location: Etc/GMT-3 (BSD style)
Status: Offline

Re: How to move ups.log and utx.log to another location?

#8

Post by Snufkin » 18 Jan 2017 18:04

Sorry for late response, struggling with Intel 82574L NIC and utp (uTorrent) protocol on NAS4Free.
crest wrote:
17 Jan 2017 08:58
Ok, I dug a little bit in the sources and the solution is quite simple...
Open System > Advanced > rc.conf in the WebGUI and add a new variable

Code: Select all

name: nut_upslog_logfile
value: /mnt/YourDirectoryPath/ups.log
hit Save and Apply Changes and restart upslog in the CLI with

Code: Select all

/etc/rc.d/nut_upslog restart
You should get a similar output like this:

Code: Select all

Stopping nut_upslog.
Waiting for PIDS: 60741.
Starting nut_upslog.
Network UPS Tools upslog 2.7.4
logging status of UPS@localhost to /mnt/DATA/ups-testlog.log (300s intervals)
Everything went smoothly and exactly as you wrote, and your further explanation helps a lot to understand how it works.
Thank you very much crest, for your time spent to write this comprehensive answer.
XNAS 11.3.0.4 embedded, ASUS P5B-E, Intel DC E6600, 4 GB DDR2, 2 x HGST HDN726040ALE614, 2 x WDC WD5000AAKS, Ippon Back Power Pro 400

Post Reply

Return to “XigmaNAS Basic Tune-up”