Guys, does NS delete old logs? I am using the Serv...
# suitescript
m
Guys, does NS delete old logs? I am using the Server Logs saved search, but I can't see except for the past 2 months.
s
Would certainly make sense if they did, if you need to see log data from that long ago, probably not the right place to store whatever you need to see. It appears to go back exactly 1 month in my tstdrv account
m
So, the solution is to save them in a custom record?
s
I only ever seem to have about 30 days worth of logs. NS does say somewhere they are free to trim the script logs as needed to free up space. If you need to log anything critical (auditing info, for example), you need to use a custom logging solution. Could be a custom record, filing cabinet log file, or external service, or some combination of the three.
m
Got it, thanks. 🙏
s
Sometimes, you can get away with adding custom info fields to an already existing record, for example an Errors field where you store any processing errors.
m
Good idea, maybe faster for debugging too, will see which one to implement.
s
another solution is to use a third party solution specifically designed for logging (e.g. logz.io, loggly, etc.)
e
Don't quote me on this but I feel like I read that they store 100,000 log lines and erase anything older than your most recent 100,000 lines
m
@stalbert How do you send the logs? with the HTTP module?
s
You can use the HTTP and/or HTTPS module, however there is governance involved with making those calls. You could write the log level, log message, and timestamp to a custom record type, then have a separate script process those records to make the HTTP calls to an external logging service if that’s an issue. However, if you are only using this for high value and critical log messages, the governance may not be an issue. The time cost to make the web service call, could be an issue though.
s
I recommend you send the logs using a background (mapreduce or scheduled script) that harvests logs using a search and ships them to the logging service using the https module.
🙏 1
✔️ 1
m
Hmm, got it, will tell the team and see how it goes.
s
with NFT, you could trivially do it real-time if needed - just by defining a log appender (NFT uses a less braindead logger than NS wherein multiple log appenders can be configured, like most logging libraries on other platforms). Even so, the background idea is still superior in that it avoids both time and governance hit for the calling script. The tradeoff is logs are delayed in appearing on the third party until the background scripts runs.
on the other hand, the loggly/logz of the world tend to have much better features than the plain netsuite log viewer. For example, rich query capability, automatic notifications and monitoring.
m
Do you have a favorite? Logz or loggly?
s
I preferred Logz.io when I last reviewed the field, but would recommend taking a peek yourself. I haven't reviewed the providers for a couple years now
m
Great, thanks.