AnsweredAssumed Answered

Open a file in append mode in LUA

Question asked by amit_saxena on Jun 11, 2011
Latest reply on Jun 11, 2011 by amit_saxena

Hi all,


I want to log the alarms data to a flat file. I wrote a script, which I am calling on a profile configured on "on arrival" mode, and inside that script, I am using file.create function.


Unfortunately every time an alarm is received by NAS, the file.create function in the script gets invoked through the profile and the file is overwritten with the new alarm.


How to ensure the following ?


1) The file is opened in append mode.

2) Locking issue, if any,  is taken care means if two or more than two alarms arrive at same time, both will try to append to the flat file at same time which might create data issues.


Also, how to provide data-time stamp in the name of the file in the format of "alarms_YYYYMMDDHHMM.txt" ?



Amit Saxena