NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

NI Linux RT - PXI - Syslog Support

Solved!
Go to solution

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?

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 1 of 10
(5,796 Views)
Solution
Accepted by RVallieu

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.

Charlie J.
National Instruments
Message 2 of 10
(5,779 Views)

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"  ....  Smiley Wink

 

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...

 

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 3 of 10
(5,761 Views)

/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!

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Message 4 of 10
(5,757 Views)

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.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 5 of 10
(5,744 Views)

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?

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 6 of 10
(5,655 Views)

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).

Message 7 of 10
(5,646 Views)

Thank you for the information.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 8 of 10
(5,636 Views)

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. 

 

0 Kudos
Message 9 of 10
(3,178 Views)

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.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 10 of 10
(3,171 Views)