08-01-2016 06:34 PM
On our VA box we have several autoload directories, with Linux shell scripts firing every fifteen minutes to see if there's anything to load. This works really well and has been doing so pretty much faultlessly for a year now.
But the logs are timestamped - every fifteen minutes, every day, every month... For auditing purposes, we realistically need to be able to go back over the last month if necessary to track any problems.
I could set up a filename pattern and use logrotate (as I've done elsewhere), but as an interim measure so I can see exactly what's going on, I'd like to be able to get the logs to accumulate daily (so the log file looks like AutoLoad_2016.08.02.log, with all today's logs together).
Calling SAS in batch mode with -log overwrites the log; other SAS batch commands (exportpackage, for example) append onto existing logs.
Does anyone have any ideas? Any other options I could try?
08-01-2016 06:47 PM
Completely untested but
proc printto log="pat\file &sysdate..txt";
might work. Add that to the start of the job.
Log says just to write the log, the bit of = is the destination file. Without the option NEW the procedure should append to the destination file.
Note that this does not turn off the other log behavior so you can experiment with options.
08-01-2016 06:51 PM - edited 08-01-2016 06:53 PM
If you can run in batch mode, PROC PRINTTO should give you viable options. You can begin each program with:
proc printto log=file of your choice mod;
Then the rest of the log will be written to the file that you designate.
The MOD option allows appending instead of replacing. You might have to adjust the code the very first time, or it might work as is.
You should be able to use macro language to automate the name of the file you write to, based on the current date.
**** EDITED: Looks like I have to type a little faster if I want to be the first to answer!
08-01-2016 07:23 PM
Yeah thanks, but I was avoiding using printto and mod. I want to specify where it goes on the command line.
I thought it was interesting that the sas and exportpackage commands appear to work differently.
08-02-2016 11:23 AM
If you're determined to avoid PRINTTO, you could try this approach.
Let the logs accumulate as separate files.
Write a SAS program to run once per day, to automatically:
That's just the big picture ... they are some details that go along with it, if this seems like a better approach.
Need further help from the community? Please ask a new question.