10-23-2019 04:54 PM - edited 10-23-2019 06:16 PM
I have a PXI2-8840QC running NI Linux RT 2019 image that we're trying out.
I have in the past run CentOS (desktop Linux) on a PXIe-8135 for evaluation for our systems.
One of the things we like to leverage is the NI Write to System Log.vi
It was plug-n-play on Centos7.6 basically.
With NI Linux RT (OpenWRT) Syslog-ng does not appear to be writing to the messages file when I utilize the NI Write to System Log.vi, but I get no errors from the VI.
Might it be a permission issue since var/log/message is owned by admin and might not be accessible to lvuser?
Solved! Go to Solution.
10-23-2019 05:05 PM
Hey Ryan,
That VI writes to a different place than the standard Linux system log when it's used. Per the help:
(NI Linux Real-Time) Open the System Log Viewer page of NI Web-based Configuration & Monitoring.
I think the RT Debug String VI does the same when directed to system log. I'm not 100% sure why this is but your guess about administrator permissions is probably a good one.
If you wanted to look at the logs in text format, I believe they are logged to /var/local/natinst/log/errlog.txt.
10-23-2019 06:01 PM - edited 10-23-2019 06:02 PM
I will check there and see. If they in fact show up there, that works - I just need to know where they appear and I can add the location to the SOP documentation.
Funny, on CentOS they logged to the usual location so I just "assumed" ....
I am unable to follow the Help - and checked there first, PXI Linux RT image does not seem to have Web Configuration.
I did verify that in NI Linux RT for PXI that I can utilize the logger command through the shell and write to the var/log/messages as expected. I will try that through a SystemExec call if needed...
10-23-2019 06:14 PM - edited 10-23-2019 06:15 PM
/var/local/natinst/log/errlog.txt is the correct location - I saw my two entries in the file that I generated with my test code calling Write to System Log.vi
Thanks!
10-23-2019 06:57 PM
I did verify that SystemExec call with "logger whatever text desired" would log into the /var/log/messages file, but I am not going to go that route, just wanted to see if it would work.
10-28-2019 01:17 PM
I am testing out writing to the files and reading them back to be able collect the errors when a system with a gui connects, as not all will have dedicated Syslog UDP collection available.
The /var/local/natinst/log/errlog.txt file seems to get zipped very often - for some reason I can not determine.
Is there a process that can be configured through a file that changes the zip behavior/timing?
10-28-2019 02:59 PM
The logrotate behavior for /var/local/natinst/log/errlog.txt is controlled by this configuration file on target '/etc/logrotate.d/nilvrterr.conf'
Right now it is set to get zipped if it grows larger than 1k which is a really conservative limit (but this file wasn't expected to grow fast). You can adjust the behavior by changing this conf file. Look up info on logrotate for an explanation of various configuration options available.
The other relevant config file is /etc/cron.d/logrotate (which tells cron how often to run logrotate).
10-28-2019 04:10 PM
Thank you for the information.
02-23-2023 09:39 AM
Were you able to find a way to log to the console that you liked?
I just invested a bit to "Write To System Log.vi" in pharlap and now we are switching some controllers to Linux. It's really nice to see logs update in realtime. Not sure if System Exec is inefficient or some how was unsatisfactory.
02-23-2023 11:03 AM - edited 02-23-2023 11:04 AM
Actually we ended up using remote UDP logging with a central error/event logger. I leveraged the NI Syslog add-on Library.
That will work for local writing as well, I believe. System Exec I have found to be very problematic in the RHEL environment.