NetSuite, as a comprehensive ERP system, generates a wealth of log data that tracks system activity, user actions, script performance, and data changes. Understanding and utilizing these logs is crucial for effective monitoring, troubleshooting, auditing, and maintaining the overall health of your NetSuite environment. This guide explores the different types of logs available, methods for extracting them to an external database for advanced analysis, and a blueprint for creating a custom NetSuite health assessment tool based on this valuable data.
NetSuite provides a range of logs designed to offer visibility into different aspects of the system. Understanding these logs is the first step towards effective system management.
Generated by SuiteScript (NetSuite's scripting language), these logs capture detailed information about the execution of custom scripts. They are indispensable for developers during debugging and for administrators monitoring script performance and resource consumption. Using the N/log module, developers can create log entries at different severity levels:
These logs can be viewed via the "Execution Log" tab on script deployment records or the dedicated "Script Execution Logs" page. Note that NetSuite typically retains these logs for 30 days.
Perhaps one of the most critical log types for governance and compliance, Audit Trails (often accessed via System Notes) provide a time-stamped record of changes made to NetSuite records, customizations, and configurations. They detail:
Audit logs are essential for tracking data modifications, security audits, and understanding system evolution.
These logs focus on background processes and specific system jobs:
Crucial for security monitoring, these logs track user login attempts, including successful logins, failed attempts, IP addresses, timestamps, and the roles used during sessions. Analyzing these logs helps identify suspicious activity or potential unauthorized access attempts.
This specialized log provides information specifically about deleted transaction records, including who performed the deletion and when. It's vital for maintaining data integrity and auditing purposes.
This log tracks changes made specifically to analytical components like saved searches, reports, and report schedules, providing visibility into how reporting and analytics configurations evolve.
The following table summarizes the primary log types and their typical use cases:
| Log Type Category | Specific Log Types / Features | Primary Use Case | Key Information Captured | Typical Retention |
|---|---|---|---|---|
| Scripting & Execution | Script Execution Logs (Debug, Audit, Error, Emergency) | Debugging custom code, performance monitoring, error tracking | Execution status, timings, custom messages, error details | 30 Days (configurable) |
| Data & Configuration Changes | Audit Trail / System Notes, Deleted Record Log, Analytics Audit Trail | Compliance, security audits, change tracking, data governance | Who, what, when, old/new values, IP address, action type | System-defined (long-term) |
| System Processes | System Logs, Activity Logs | Monitoring background jobs, scheduled tasks, integrations, specific module activities | Job status (success/failure), execution times, processed records | Varies by log/module |
| Security & Access | Login Audit Trail / Access Logs | Security monitoring, identifying unauthorized access attempts | Login success/failure, timestamps, IP addresses, user roles | System-defined |
While NetSuite provides interfaces to view logs, extracting them to an external database unlocks possibilities for long-term archiving, advanced analytics, correlation with other data sources, and centralized monitoring. Here are common methods:
This is a highly flexible approach using NetSuite's native scripting capabilities. A scheduled script can be written to:
N/search for System Notes) or specific log APIs.N/https module to send (POST) the log data to an external API endpoint connected to your database.This method offers granular control over what data is extracted and how it's processed but requires SuiteScript development expertise.
// Example snippet concept for searching audit trail logs
// Note: This is illustrative and needs error handling, pagination, etc.
require(['N/search', 'N/https'], function(search, https) {
function extractAuditLogs() {
var auditSearch = search.create({
type: search.Type.SYSTEM_NOTE,
filters: [
// Example: Filter by date or record type if needed
// ['date', 'onorafter', 'yesterday']
],
columns: [
'date', 'recordtype', 'recordid', 'field', 'oldvalue', 'newvalue', 'user', 'role'
// Add other relevant columns
]
});
var logEntries = [];
// Consider using PagedData for large result sets
auditSearch.run().each(function(result) {
logEntries.push({
date: result.getValue('date'),
recordType: result.getValue('recordtype'),
recordId: result.getValue('recordid'),
field: result.getText('field') || result.getValue('field'), // Get text if available
oldValue: result.getValue('oldvalue'),
newValue: result.getValue('newvalue'),
user: result.getText('user'), // Get user name
role: result.getText('role') // Get role name
});
// Send in batches to avoid large payloads
if (logEntries.length >= 100) {
sendToExternalDB(logEntries);
logEntries = [];
}
return true; // Continue iteration
});
// Send any remaining entries
if (logEntries.length > 0) {
sendToExternalDB(logEntries);
}
}
function sendToExternalDB(data) {
try {
var response = https.post({
url: 'YOUR_EXTERNAL_API_ENDPOINT', // Replace with your actual endpoint
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY' // Example authorization
}
});
// Log success or handle response codes (2xx, 4xx, 5xx)
log.audit('Log Batch Sent', 'Response Code: ' + response.code);
} catch (e) {
log.error('Error Sending Logs', e);
}
}
// Call the function, typically within a scheduled script execution context
// extractAuditLogs();
});
NetSuite offers the SuiteAnalytics Connect service, which provides ODBC, JDBC, and ADO.NET access to your NetSuite data, essentially treating it like a relational database. If the required log data is exposed through Connect schemas (this may vary), you can use standard SQL queries from external tools (ETL platforms, BI tools, custom applications) to pull log data directly. This method requires purchasing the SuiteAnalytics Connect module.
You can build custom RESTlets within NetSuite specifically designed to expose log data. External applications can then call these RESTful endpoints periodically to retrieve logs. Alternatively, NetSuite's standard SOAP or REST web services might offer ways to query certain log-related records, though dedicated log access might be limited compared to SuiteScript or Connect.
Many integration platforms (iPaaS) and ETL (Extract, Transform, Load) tools like Celigo, Boomi, MuleSoft, Rivery, or Informatica offer pre-built NetSuite connectors. These connectors often simplify the process of extracting various data types, potentially including logs, and loading them into external databases or data warehouses with minimal custom coding.
For simpler or less frequent needs, many logs can be viewed as Saved Searches or Reports within NetSuite, which can then be manually or sometimes programmatically exported as CSV files. These files can then be imported into an external database using standard database import tools or scripts. This is generally less suitable for real-time or high-volume automated extraction.
This mindmap illustrates the relationship between NetSuite's logs, extraction methods, and the goal of building a health assessment tool.
Once logs are consistently extracted to an external database, you can build a powerful health assessment tool to provide ongoing insights into your NetSuite environment's well-being.
The primary goal of a NetSuite health assessment tool is to proactively monitor the system's performance, security posture, data integrity, and compliance status. Benefits include:
The tool would ingest and process data primarily from the extracted logs:
The tool should focus on analyzing logs to assess health across several dimensions:
A radar chart can provide a high-level overview of the assessed health across different areas. The scores below are illustrative, representing a snapshot based on log analysis findings compared to target goals and industry benchmarks.
Provide intuitive visualizations (like the radar chart above, time-series graphs for error rates, tables for critical changes) summarizing key health metrics, trends, and historical data. Allow users to drill down into specific logs or events.
Example of a dashboard visualizing key business metrics, similar principles apply to a health assessment tool.
Configure rules to trigger real-time alerts (via email, Slack, or other channels) for critical events, such as a spike in script errors, failed critical jobs, emergency log entries, or suspicious login activity.
Based on the analysis, the tool could suggest potential actions, such as identifying specific scripts for optimization, recommending review of certain user permissions, or highlighting configuration areas needing attention.
Implement a scoring system (as shown in the radar chart) to provide a quantifiable measure of system health over time, allowing for easy tracking of improvements or degradation.
The following video provides insights into using the N/log module in SuiteScript, which is fundamental for generating script execution logs discussed earlier. Understanding how these logs are created helps in interpreting them within your health assessment tool.
Exploration of the SuiteScript N/log module and script execution logs.