<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en_US"><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://chrisphillips-cminion.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://chrisphillips-cminion.github.io/" rel="alternate" type="text/html" hreflang="en_US" /><updated>2026-11-12T19:20:29+00:00</updated><id>https://chrisphillips-cminion.github.io/feed.xml</id><title type="html">Chris Phillips’ Blog</title><subtitle>Technical blog covering API Connect, IBM DataPower, API Management, Integration, Kubernetes, OpenShift, and Cloud Native technologies. Expert insights on API governance, microservices architecture, and enterprise integration patterns.</subtitle><author><name>ChrisPhillips</name></author><entry><title type="html">webMethods API Gateway: Enable the Tracer and Set the Trace Timeout</title><link href="https://chrisphillips-cminion.github.io/webmethods/2026/11/12/webmethods-apigw-enable-trace-and-timeout.html" rel="alternate" type="text/html" title="webMethods API Gateway: Enable the Tracer and Set the Trace Timeout" /><published>2026-11-12T18:00:00+00:00</published><updated>2026-11-12T18:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/webmethods/2026/11/12/webmethods-apigw-enable-trace-and-timeout</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/webmethods/2026/11/12/webmethods-apigw-enable-trace-and-timeout.html"><![CDATA[<p>An API call is failing and you cannot see why. The tracer in webMethods API Gateway shows each policy that ran, how long it took, and the request and response at every hop.</p>

<p>This post is based on the IBM webMethods API Gateway (SaaS) 11.1.0 documentation.</p>

<!--more-->
<h2 id="enable-the-tracer">Enable the tracer</h2>

<p>You need the <strong>Manage APIs</strong> privilege, and the API must be in an active state.</p>

<h3 id="step-1-open-the-api">Step 1: Open the API</h3>

<ol>
  <li>Open the menu options and select <strong>APIs</strong>.</li>
  <li>Click the API you want to trace.</li>
</ol>

<h3 id="step-2-enable-tracing">Step 2: Enable tracing</h3>

<ol>
  <li>Click <strong>Enable tracing</strong>.</li>
  <li>The API details page now shows a warning: <code class="language-plaintext highlighter-rouge">This API has tracing enabled. Tracing impacts performance and storage, hence disable tracing when it is not needed.</code></li>
</ol>

<h3 id="step-3-send-a-request-and-open-the-tracer-tab">Step 3: Send a request and open the Tracer tab</h3>

<ol>
  <li>Call the API.</li>
  <li>Click the <strong>Tracer</strong> tab.</li>
  <li>The <strong>Trace API</strong> page has three sections: <strong>Runtime events</strong>, <strong>Policies applied</strong> and <strong>Event tracer details</strong>.</li>
</ol>

<p>Tracing works for REST, SOAP and OData APIs only.</p>

<h2 id="read-a-trace">Read a trace</h2>

<ol>
  <li>In <strong>Runtime events</strong>, click the client request you want to look at.</li>
  <li><strong>Event tracer details</strong> shows <strong>General Information</strong>, <strong>API request and response</strong> and <strong>Server logs</strong>.</li>
  <li><strong>API request and response</strong> has four parts:
    <ul>
      <li>The request sent by the client.</li>
      <li>The response sent to the client.</li>
      <li>The request sent to the native service.</li>
      <li>The response sent by the native service.</li>
    </ul>
  </li>
  <li>In <strong>Policies applied</strong>, click a stage name to see the status and response time of that stage and its policies.</li>
  <li>Click a policy name to see its configuration, its input and its output.</li>
</ol>

<p>A <strong>Success</strong> status means the policy ran. It does not mean the policy’s conditions matched. Click the policy to see how the conditions were applied.</p>

<p>A stage with no policies enforced during the call is greyed out. The Error Handling stage is the usual example.</p>

<h2 id="set-the-trace-timeout">Set the trace timeout</h2>

<p>The tracer switches itself off after a timeout. The default is 300 seconds (5 minutes). You control it with the <code class="language-plaintext highlighter-rouge">tracerTimeoutSecs</code> extended setting.</p>

<p>You need the <strong>Manage user administration</strong> functional privilege.</p>

<ol>
  <li>Open the menu options and select <strong>Administration</strong>.</li>
  <li>Select <strong>General &gt; Extended settings</strong>.</li>
  <li>Click <strong>Show and hide keys</strong>.</li>
  <li>Find <code class="language-plaintext highlighter-rouge">tracerTimeoutSecs</code> in the <strong>Extended keys</strong> section and enter a value in seconds.</li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<p>The change takes effect immediately. No restart is needed.</p>

<p>The minimum is 1 second and the maximum is 300 seconds. You can make the tracer stop sooner. You cannot make it run longer than 5 minutes. If you need more time, click <strong>Enable tracing</strong> again after it stops.</p>

<blockquote>
  <p>IBM’s page for extended settings says not to change them unless IBM Global Support asks you to. Check with support before changing <code class="language-plaintext highlighter-rouge">tracerTimeoutSecs</code> on a production tenant.</p>
</blockquote>

<h2 id="things-that-catch-people-out">Things that catch people out</h2>

<ul>
  <li><strong>Traces appear slowly.</strong> The tracer data is pushed as a single bulk request, so there is a minimum delay of 5 seconds before a request shows in the UI.</li>
  <li><strong>Not every request is traced.</strong> The tracer is throttled to protect the gateway. The documentation says one request per second per node. Other requests in that window are dropped. The <code class="language-plaintext highlighter-rouge">throttleTracerBucketLeakRate</code> setting controls this.</li>
  <li><strong>Only recent traces are kept.</strong> The last 100 requests are retained by default. <code class="language-plaintext highlighter-rouge">allowedTracerCount</code> changes this. The default is 100 and the maximum is 1000.</li>
  <li><strong>Tracing switches off when the API changes.</strong> It is disabled on a new version of the API, after an import with Overwrite set to <strong>All</strong> or <strong>Custom - API</strong>, and after a promotion with <strong>Overwrites assets except alias that already exist on the selected target stages</strong>. Enable it again after each.</li>
  <li><strong>Streaming bodies are not captured.</strong> This applies even with the tracer on.</li>
</ul>

<h2 id="limitations-and-notes">Limitations and Notes</h2>

<ul>
  <li>Threat protection policies and rules cannot be traced.</li>
  <li>Microgateway groups cannot be traced.</li>
  <li>Tracing can be enabled and disabled through the Service Management REST API. See the IBM documentation for the details.</li>
  <li>Two IBM pages describe <code class="language-plaintext highlighter-rouge">throttleTracerBucketLeakRate</code> differently. The debugging page says one request per second per node. The extended settings page says the value is in milliseconds with a default of 100. I have not tested which is right on a live tenant.</li>
</ul>

<h2 id="references">References</h2>

<ul>
  <li><a href="https://www.ibm.com/docs/en/wams/wm-api-gateway-saas/11.1.0?topic=implementation-debugging-api">Debugging API</a></li>
  <li><a href="https://www.ibm.com/docs/en/wams/wm-api-gateway-saas/11.1.0?topic=api-enabling-tracing">Enabling tracing</a></li>
  <li><a href="https://www.ibm.com/docs/en/wams/wm-api-gateway-saas/11.1.0?topic=api-viewing-trace-details">Viewing trace details</a></li>
  <li><a href="https://www.ibm.com/docs/en/wams/wm-api-gateway-saas/11.1.0?topic=administering-configuring-extended-settings">Configuring extended settings</a></li>
</ul>]]></content><author><name>[&quot;ChrisPhillips&quot;, &quot;ChrisGilroy&quot;, &quot;IBMBob&quot;]</name></author><category term="webMethods" /><category term="webMethods" /><category term="APIGateway" /><category term="Trace" /><category term="Debugging" /><category term="Troubleshooting" /><summary type="html"><![CDATA[How to turn on the tracer for an API in IBM webMethods API Gateway (SaaS) 11.1, read the results, and change how long the tracer stays on using tracerTimeoutSecs.]]></summary></entry><entry><title type="html">Logitech G Hub Not Working on macOS — The Fix</title><link href="https://chrisphillips-cminion.github.io/tools/2026/09/21/logitech-g502x-ghub-macos-fix.html" rel="alternate" type="text/html" title="Logitech G Hub Not Working on macOS — The Fix" /><published>2026-09-21T09:00:00+00:00</published><updated>2026-09-21T09:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/tools/2026/09/21/logitech-g502x-ghub-macos-fix</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/tools/2026/09/21/logitech-g502x-ghub-macos-fix.html"><![CDATA[<p>After installing <a href="https://www.logitechg.com/en-gb/innovation/g-hub.html">Logitech G Hub</a> for the <a href="https://www.amazon.co.uk/dp/B07W7LW3VV?th=1&amp;linkCode=ll2&amp;tag=chrisphilli03-21&amp;linkId=ce9be1868d29ba9f4c06345b54b0734e&amp;ref_=as_li_ss_tl">G502X</a>, nothing worked. Weeks of frustration until <a href="https://www.reddit.com/r/LogitechG/comments/113ls7a/logitech_g502_macos_ventura_device_inactive/">a Reddit thread had the answer</a>.</p>

<p><img src="/images/2026-09-21-logitech-ghub.jpg" alt="Logitech G Hub Privacy settings on macOS" /></p>

<!--more-->

<p>Go to <strong>Settings → Privacy &amp; Security → Input Monitoring</strong> and make sure <strong>Logitech G Hub Agent</strong> is enabled.</p>

<p>Then go to <strong>Accessibility</strong> in the same section and make sure both <strong>G Hub</strong> and <strong>G Hub Agent</strong> are on.</p>

<p>That’s it. Mouse and keyboard work and I can change the DPI settings. No idea why Logitech doesn’t auto-enable these permissions on install.</p>]]></content><author><name>[&quot;ChrisPhillips&quot;]</name></author><category term="Tools" /><category term="Logitech" /><category term="macOS" /><category term="G502X" /><category term="GHub" /><summary type="html"><![CDATA[After installing Logitech G Hub for the G502X, nothing worked. Weeks of frustration until a Reddit thread had the answer.]]></summary></entry><entry><title type="html">Essential DataPower Logging when using API Connect: 5 Critical Log Types for Production Monitoring</title><link href="https://chrisphillips-cminion.github.io/apiconnect/2026/07/28/datapower-extra-log.html" rel="alternate" type="text/html" title="Essential DataPower Logging when using API Connect: 5 Critical Log Types for Production Monitoring" /><published>2026-07-28T00:14:00+00:00</published><updated>2026-07-28T00:14:00+00:00</updated><id>https://chrisphillips-cminion.github.io/apiconnect/2026/07/28/datapower-extra-log</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/apiconnect/2026/07/28/datapower-extra-log.html"><![CDATA[<p>When configuring IBM DataPower for production, proper logging is essential for troubleshooting, performance monitoring, and capacity planning. This guide covers five critical logging types that every DataPower deployment should have enabled.</p>

<!--more-->

<h2 id="1-why-these-logs-matter">1. Why These Logs Matter</h2>

<p>In production environments, you need visibility into:</p>
<ul>
  <li>System resource utilization</li>
  <li>API synchronization between API Manager and DataPower</li>
  <li>Transaction latency and performance</li>
  <li>Detailed system metrics for capacity planning</li>
</ul>

<p>These five log types provide comprehensive coverage without overwhelming your logging infrastructure.</p>

<h2 id="2-quick-reference-the-5-essential-logs">2. Quick Reference: The 5 Essential Logs</h2>

<table>
  <thead>
    <tr>
      <th>Log Type</th>
      <th>Purpose</th>
      <th>When to Use</th>
      <th>Collection Method</th>
      <th>Storage Impact</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a href="#3-system-usage-table"><strong>System Usage Table</strong></a></td>
      <td>Real-time resource monitoring</td>
      <td>Continuous monitoring</td>
      <td>REST/SOMA API query</td>
      <td>Low</td>
    </tr>
    <tr>
      <td><a href="#4-api-connect-gateway-service-logs"><strong>API Connect Gateway Service</strong></a></td>
      <td>API sync communication</td>
      <td>Troubleshooting sync issues</td>
      <td>Log target: <code class="language-plaintext highlighter-rouge">apic-gw-service debug</code></td>
      <td>Low</td>
    </tr>
    <tr>
      <td><a href="#5-collection-log"><strong>Collection Log</strong></a></td>
      <td>DataPower object creation</td>
      <td>Troubleshooting config issues</td>
      <td>Log targets: <code class="language-plaintext highlighter-rouge">cli debug</code> and <code class="language-plaintext highlighter-rouge">mgmt info</code></td>
      <td>Low</td>
    </tr>
    <tr>
      <td><a href="#6-dpmon-datapower-monitoring"><strong>dpMon</strong></a></td>
      <td>Detailed system metrics</td>
      <td>Capacity planning &amp; deep analysis</td>
      <td>File collection every 2 hours</td>
      <td>High</td>
    </tr>
    <tr>
      <td><a href="#7-extlatency-extended-latency"><strong>ExtLatency</strong></a></td>
      <td>Transaction latency breakdown</td>
      <td>Performance troubleshooting</td>
      <td>Log target: <code class="language-plaintext highlighter-rouge">extlatency info</code></td>
      <td>Medium-High</td>
    </tr>
  </tbody>
</table>

<hr />

<h2 id="3-system-usage-table">3. System Usage Table</h2>

<p><strong>What It Does:</strong>
Provides real-time visibility into DataPower’s current workload and resource utilization.</p>

<p><strong>Key Metrics to Collect:</strong></p>
<ul>
  <li><strong>Load Percentage</strong> - Overall system load</li>
  <li><strong>CPU Percentage</strong> - CPU utilization</li>
  <li><strong>Worklist</strong> - Number of tasks awaiting scheduling</li>
  <li><strong>File Count</strong> - Open file handles</li>
</ul>

<p><strong>How to Access:</strong>
Available via REST or SOMA interface. Query this table periodically (every 30-60 seconds) to track system health.</p>

<p><strong>Why It Matters:</strong>
When your gateway starts queuing requests or experiencing performance issues, the System Usage Table shows you exactly what’s happening at the system level.</p>

<p><strong>Example REST Query:</strong></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-u</span> admin:password <span class="se">\</span>
  https://datapower-host:5554/mgmt/status/default/SystemUsageTable
</code></pre></div></div>

<blockquote>
  <p><strong>Note:</strong> The example above uses basic auth with inline credentials for illustration only. In production, use a credentials store or environment variable rather than a literal password, and ensure the management interface is protected by a valid TLS certificate (avoid <code class="language-plaintext highlighter-rouge">-k</code> / <code class="language-plaintext highlighter-rouge">--insecure</code>).</p>
</blockquote>

<h2 id="4-api-connect-gateway-service-logs">4. API Connect Gateway Service Logs</h2>

<p><strong>What It Does:</strong>
Captures communication between API Manager and DataPower, showing API synchronization activity.</p>

<p><strong>Configuration:</strong></p>

<p>Create a log target with the following subscription:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>event apic-gw-service debug
</code></pre></div></div>

<p><strong>Kubernetes Best Practice:</strong>
In containerized environments, send this to the default log in the default domain so Kubernetes can collect it as part of pod logs:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kubectl logs &lt;datapower-pod-name&gt; <span class="nt">-n</span> &lt;namespace&gt;
</code></pre></div></div>

<p><strong>Why It Matters:</strong>
When APIs aren’t syncing properly or you’re seeing unexpected behavior after publishing, API Connect Gateway Service logs show you exactly what’s happening during the synchronization process.</p>

<p><strong>What to Look For:</strong></p>
<ul>
  <li>API publish/unpublish events</li>
  <li>Synchronization errors</li>
  <li>Communication failures between API Manager and gateway</li>
</ul>

<p><strong>Note:</strong> This is enabled by default in container deployments.</p>

<h2 id="5-collection-log">5. Collection Log</h2>

<p><strong>What It Does:</strong>
Tracks the creation and modification of DataPower objects during API synchronization.</p>

<p><strong>Configuration:</strong></p>

<p>Create a log target with these subscriptions:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>event cli debug
event mgmt info
</code></pre></div></div>

<p><strong>Kubernetes Best Practice:</strong>
Send to the default log in the default domain for pod log collection.</p>

<p><strong>Why It Matters:</strong>
Shows you the actual DataPower configuration changes being made when APIs are published. Essential for troubleshooting configuration issues.</p>

<p><strong>What to Look For:</strong></p>
<ul>
  <li>Object creation/deletion events</li>
  <li>Configuration changes</li>
  <li>Errors during object creation</li>
  <li>Policy assembly modifications</li>
</ul>

<p><strong>Use Case:</strong>
When an API publishes successfully in API Manager but doesn’t work in the gateway, Collection logs show you if the DataPower objects were created correctly.</p>

<h2 id="6-dpmon-datapower-monitoring">6. dpMon (DataPower Monitoring)</h2>

<p><strong>What It Does:</strong>
Generates nmon-format snapshot files containing detailed system metrics.</p>

<p><strong>Default Configuration:</strong></p>
<ul>
  <li><strong>Snapshot Duration:</strong> 900 seconds (15 minutes) per file</li>
  <li><strong>Rotation:</strong> 9 files</li>
  <li><strong>Total Coverage:</strong> ~2.25 hours of detailed metrics</li>
</ul>

<p><strong>Collection Strategy:</strong></p>

<p>For debugging or capacity analysis, copy files every 2 hours:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Kubernetes environment</span>
kubectl <span class="nb">cp</span> &lt;namespace&gt;/&lt;pod-name&gt;:temporary/dpmon/dpmon_<span class="k">*</span>.nmon ./dpmon-files/

<span class="c"># Direct DataPower access</span>
scp admin@datapower-host:temporary/dpmon/dpmon_<span class="k">*</span>.nmon ./dpmon-files/
</code></pre></div></div>

<p><strong>Why It Matters:</strong>
dpMon provides the most detailed system metrics available, including:</p>
<ul>
  <li>CPU usage per core</li>
  <li>Memory utilization</li>
  <li>Disk I/O</li>
  <li>Network statistics</li>
  <li>Process-level details</li>
</ul>

<p><strong>Analysis:</strong>
Use nmon analyzer tools to visualize the data and identify performance patterns, bottlenecks, and capacity issues.</p>

<p><strong>Storage Consideration:</strong>
These files are large. Only collect them during active debugging or capacity analysis periods, not continuously in production.</p>

<h2 id="7-extlatency-extended-latency">7. ExtLatency (Extended Latency)</h2>

<p><strong>What It Does:</strong>
Provides detailed latency breakdown for every transaction, showing exactly where time is spent.</p>

<p><strong>Configuration:</strong></p>

<p>First, enable Extended Transaction Logging at the device level: <strong>Administration → Device → Extended Transaction Logging</strong> in the WebGUI, or via the CLI in the relevant domain.</p>

<p>Then create a log target with this subscription:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>event extlatency info
</code></pre></div></div>

<p><strong>Kubernetes Best Practice:</strong>
Send to the default log in the default domain for pod log collection.</p>

<p><strong>What You Get:</strong></p>

<p>ExtLatency logs show time spent in each processing stage:</p>
<ul>
  <li>Request parsing</li>
  <li>Policy execution</li>
  <li>Backend calls</li>
  <li>Response processing</li>
  <li>Total transaction time</li>
</ul>

<p><strong>Why It Matters:</strong>
When users report slow APIs, ExtLatency tells you exactly where the time is going. Is it your backend? Policy execution? Network latency?</p>

<p><strong>Use Case:</strong></p>
<ul>
  <li>Performance troubleshooting</li>
  <li>SLA monitoring</li>
  <li>Capacity planning</li>
  <li>Identifying slow backends</li>
</ul>

<h2 id="8--create-log-targets">8.  Create Log Targets</h2>

<p>For each log type (except System Usage Table and dpMon), create a log target:</p>

<p><strong>Via CLI:</strong></p>

<p>Note: the log target must be created in the domain where the service runs (e.g. <code class="language-plaintext highlighter-rouge">apiconnect</code>), not the default domain.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>top; configure; switch &lt;domain&gt;
logging target &lt;target-name&gt;
  type file
  format text
  timestamp zulu
  size 100
  local-file logtemp:///&lt;filename&gt;
  event &lt;subscription&gt;
exit
write memory
</code></pre></div></div>

<p><strong>Via WebGUI:</strong></p>
<ol>
  <li>Navigate to Objects → Logging → Log Target</li>
  <li>Click “Add”</li>
  <li>Configure target with appropriate event subscriptions</li>
</ol>

<h2 id="9-log-rotation-and-retention">9. Log Rotation and Retention</h2>

<p><strong>Best Practices:</strong></p>

<table>
  <thead>
    <tr>
      <th>Log Type</th>
      <th>Rotation</th>
      <th>Retention</th>
      <th>Storage Impact</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>APIC GW Service</td>
      <td>10 MB or daily</td>
      <td>7 days</td>
      <td>Low</td>
    </tr>
    <tr>
      <td>Collection</td>
      <td>10 MB or daily</td>
      <td>7 days</td>
      <td>Low</td>
    </tr>
    <tr>
      <td>ExtLatency</td>
      <td>50 MB or daily</td>
      <td>3 days</td>
      <td>Medium-High</td>
    </tr>
    <tr>
      <td>dpMon</td>
      <td>Automatic (9 files)</td>
      <td>Copy every 2 hours</td>
      <td>High</td>
    </tr>
    <tr>
      <td>System Usage</td>
      <td>N/A (API query)</td>
      <td>Store in monitoring system</td>
      <td>Low</td>
    </tr>
  </tbody>
</table>

<p><strong>Storage Calculation:</strong></p>

<p>For a busy gateway processing 1000 TPS:</p>
<ul>
  <li>ExtLatency: ~500 MB/day</li>
  <li>APIC GW Service + Collection: ~100 MB/day</li>
  <li>dpMon: ~50 MB/hour</li>
</ul>

<p>Plan storage accordingly, especially for ExtLatency in high-traffic environments.</p>

<h2 id="10-monitoring-and-alerting">10. Monitoring and Alerting</h2>

<p><strong>Key Metrics to Alert On:</strong></p>

<p>From <strong>System Usage Table:</strong></p>
<ul>
  <li>CPU &gt; 80% for 5 minutes</li>
  <li>Worklist &gt; 100 consistently</li>
  <li>Load percentage &gt; 90%</li>
</ul>

<p>From <strong>ExtLatency:</strong></p>
<ul>
  <li>Average latency &gt; SLA threshold</li>
  <li>Backend latency &gt; expected baseline</li>
  <li>Sudden latency spikes</li>
</ul>

<p>From <strong>APIC GW Service/Collection Logs:</strong></p>
<ul>
  <li>Synchronization failures</li>
  <li>Object creation errors</li>
  <li>Communication timeouts</li>
</ul>

<h2 id="11-troubleshooting-common-issues">11. Troubleshooting Common Issues</h2>

<h3 id="111-high-cpu-with-low-throughput">11.1. High CPU with Low Throughput</h3>

<p><strong>Check:</strong></p>
<ol>
  <li>System Usage Table - Look at worklist</li>
  <li>ExtLatency - Identify slow transactions</li>
  <li>dpMon - Analyze CPU usage patterns</li>
</ol>

<p><strong>Common Causes:</strong></p>
<ul>
  <li>GatewayScript bottlenecks</li>
  <li>Inefficient policies</li>
  <li>Memory pressure causing swapping</li>
</ul>

<h3 id="112-api-sync-failures">11.2. API Sync Failures</h3>

<p><strong>Check:</strong></p>
<ol>
  <li>APIC GW Service logs - Communication errors</li>
  <li>Collection logs - Object creation failures</li>
</ol>

<p><strong>Common Causes:</strong></p>
<ul>
  <li>Network connectivity issues</li>
  <li>Certificate problems</li>
  <li>Insufficient permissions</li>
</ul>

<h3 id="113-intermittent-slowness">11.3. Intermittent Slowness</h3>

<p><strong>Check:</strong></p>
<ol>
  <li>ExtLatency - Identify timing patterns</li>
  <li>dpMon - Correlate with system metrics</li>
  <li>System Usage Table - Look for resource spikes</li>
</ol>

<p><strong>Common Causes:</strong></p>
<ul>
  <li>Backend performance issues</li>
  <li>Garbage collection pauses</li>
  <li>Network congestion</li>
</ul>

<h2 id="12-best-practices-summary">12. Best Practices Summary</h2>

<ol>
  <li><strong>Enable all five log types</strong> in production environments</li>
  <li><strong>Use Kubernetes pod logs</strong> for containerized deployments</li>
  <li><strong>Set up automated collection</strong> for System Usage Table</li>
  <li><strong>Configure appropriate retention</strong> based on your storage capacity and requirements</li>
  <li><strong>Monitor key metrics</strong> and set up alerts</li>
  <li><strong>Correlate logs</strong> when troubleshooting - use multiple log types together</li>
</ol>

<h2 id="13-conclusion">13. Conclusion</h2>

<p>These five logging configurations provide comprehensive visibility into your DataPower environment without overwhelming your logging infrastructure. By implementing them properly, you’ll have the data you need to:</p>

<ul>
  <li>Troubleshoot issues quickly</li>
  <li>Monitor performance proactively</li>
  <li>Plan capacity accurately</li>
  <li>Meet SLA requirements</li>
</ul>

<p>Start with these five, tune retention based on your needs, and you’ll have a solid foundation for DataPower observability.</p>

<hr />

<p><em>Questions about DataPower logging? Drop a comment below or reach out directly.</em></p>]]></content><author><name>[&quot;ChrisPhillips&quot;]</name></author><category term="APIConnect" /><category term="DataPower" /><category term="Logging" /><category term="Monitoring" /><category term="APIConnect" /><category term="Performance" /><category term="Troubleshooting" /><summary type="html"><![CDATA[A practical guide to the five most important logging configurations for IBM DataPower in production environments, including system usage, API synchronization, and performance monitoring.]]></summary></entry><entry><title type="html">DataPower Memory and Performance: Understanding What Normal Looks Like (Before You Open a Ticket)</title><link href="https://chrisphillips-cminion.github.io/datapower/2026/07/24/95-DataPower-Memory-and-Performance-Understanding-What-Normal-Looks-Like.html" rel="alternate" type="text/html" title="DataPower Memory and Performance: Understanding What Normal Looks Like (Before You Open a Ticket)" /><published>2026-07-24T18:07:00+00:00</published><updated>2026-07-24T18:07:00+00:00</updated><id>https://chrisphillips-cminion.github.io/datapower/2026/07/24/95-DataPower-Memory-and-Performance-Understanding-What-Normal-Looks-Like</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/datapower/2026/07/24/95-DataPower-Memory-and-Performance-Understanding-What-Normal-Looks-Like.html"><![CDATA[<p>Rising memory on a DataPower appliance is not automatically a problem — but knowing whether it is requires understanding what the numbers actually mean.</p>

<p><img src="/images/cpu.png" alt="CPU Sample graph" /></p>

<!--more-->

<p>Comparing raw memory percentages between HA pair appliances is misleading. Two appliances with identical firmware and configuration can show different memory usage simply because one has been running longer or has a warmer cache.</p>

<h2 id="1-how-datapower-allocates-memory">1. How DataPower Allocates Memory</h2>

<p>DataPower divides memory into several regions:</p>

<ul>
  <li><strong>Firmware-reserved:</strong> The OS and DataPower firmware services reserve a fixed portion. It is not available for application use.</li>
  <li><strong>Domain memory:</strong> Each domain has its own chunk. Domains process API traffic and hold configurations.</li>
  <li><strong>Application buffers:</strong> Used for XML parsing, JSON processing, HTTP connection handling, and XSLT transformations. Allocated from a shared buffer pool.</li>
  <li><strong>Compilation cache:</strong> GatewayScript and XSLT compiled code is cached in memory. More traffic means more compiled code, which means more memory used.</li>
  <li><strong>Filesystem regions (<code class="language-plaintext highlighter-rouge">temporary</code>, <code class="language-plaintext highlighter-rouge">image</code>, <code class="language-plaintext highlighter-rouge">internal</code>):</strong> These count as physical memory usage. <code class="language-plaintext highlighter-rouge">temporary</code> is used by API Connect and gateway peering to load shared state. <code class="language-plaintext highlighter-rouge">internal</code> is where GatewayScript and XSLT are compiled and executed. <code class="language-plaintext highlighter-rouge">image</code> holds firmware and domain package data. None of this shows up at startup — it accumulates as caches warm, APIs are deployed, and peering loads its data. This is expected growth, not a leak.</li>
</ul>

<p>The <code class="language-plaintext highlighter-rouge">show memory</code> output from the CLI (<a href="https://www.ibm.com/docs/en/datapower-gateway/10.6.0?topic=commands-show-memory">IBM docs: show memory</a>):</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>DataPower# show memory

Memory usage:      62%
Installed memory:  8388608 KB
Available memory:  3145728 KB
Used memory:       5242880 KB
Reserved memory:   1048576 KB
Total memory:      7340032 KB
Requested memory:  4915200 KB
Hold memory:       131072 KB
Inactive memory:   524288 KB
</code></pre></div></div>

<p>Fields to know:</p>

<ul>
  <li><strong>Installed memory</strong> — total physical RAM on the appliance.</li>
  <li><strong>Total memory</strong> — memory available to DataPower after firmware overhead.</li>
  <li><strong>Used memory</strong> — memory actively in use.</li>
  <li><strong>Available memory</strong> — free memory. Watch this trending over time; consistent day-over-day drops without traffic growth indicate a leak.</li>
  <li><strong>Reserved memory</strong> — pre-allocated for internal use, not available to services.</li>
  <li><strong>Requested memory</strong> — memory requested by running processes (can exceed Used when memory is fragmented).</li>
  <li><strong>Hold memory</strong> — memory held by the system that has been freed by processes but not yet returned to the pool.</li>
  <li><strong>Inactive memory</strong> — memory allocated but not recently accessed. DataPower can reclaim it under pressure. A large inactive pool is normal and healthy; it means the system is caching aggressively. It only becomes a concern if Available drops while Inactive is also near zero.</li>
</ul>

<p>Note that <code class="language-plaintext highlighter-rouge">show memory</code> is system-level — per-domain breakdown is in the error report’s <code class="language-plaintext highlighter-rouge">DomainsMemoryStatus2.xml</code>. The per-domain figures in that file must be treated as indicative rather than precise.</p>

<h2 id="2-normal-memory-growth-vs-genuine-memory-leak">2. Normal Memory Growth vs. Genuine Memory Leak</h2>

<p>Expected growth happens in three scenarios:</p>

<ul>
  <li>New APIs deployed → new domain configurations loaded → more domain memory</li>
  <li>Traffic growth → more application buffers allocated</li>
  <li>Longer uptime → larger compilation cache, and more data loaded into <code class="language-plaintext highlighter-rouge">temporary</code> (API Connect/gateway peering state) and <code class="language-plaintext highlighter-rouge">internal</code> (compiled GatewayScript/XSLT). This is why memory on a freshly restarted appliance will always look lower than the same appliance after a few hours under load.</li>
</ul>

<p>Leak indicators:</p>

<ul>
  <li><strong>Available memory</strong> (system-level) drops by more than 10% per day with no change in traffic or configuration</li>
  <li>After restarting a domain (not the appliance), system-level memory does not return to baseline</li>
</ul>

<blockquote>
  <p><strong>Note:</strong> Genuine memory leaks will not show up in the domain/service-level memory status providers (<code class="language-plaintext highlighter-rouge">DomainsMemoryStatus2.xml</code>). That is precisely why they are leaks — the accounting doesn’t capture them. If you suspect a leak, track it at the system level via <code class="language-plaintext highlighter-rouge">show memory</code> and <code class="language-plaintext highlighter-rouge">MemoryStatus2.xml</code> over time.</p>
</blockquote>

<p><strong>Diagnosing with an error report:</strong></p>

<p>Generate one with:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>generate error-report
</code></pre></div></div>

<p>Relevant files for memory leak diagnosis:</p>

<ul>
  <li><strong><code class="language-plaintext highlighter-rouge">MemoryStatus2.xml</code></strong> — system-level snapshot (<code class="language-plaintext highlighter-rouge">Usage</code>, <code class="language-plaintext highlighter-rouge">AvailableMemory</code>, <code class="language-plaintext highlighter-rouge">UsedMemory</code>, <code class="language-plaintext highlighter-rouge">TotalMemory</code>). This is the primary file for leak detection — track <code class="language-plaintext highlighter-rouge">AvailableMemory</code> over time.</li>
  <li><strong><code class="language-plaintext highlighter-rouge">DomainsMemoryStatus2.xml</code></strong> — per-domain memory counters. These figures have known accuracy limitations and will not reveal a genuine memory leak (leaks don’t surface in domain-level accounting). Use them as a rough guide to which domain is the largest consumer, not as precise measurements.</li>
  <li><strong><code class="language-plaintext highlighter-rouge">DocumentCachingSummary.xml</code></strong> — per-XMLManager document cache (<code class="language-plaintext highlighter-rouge">DocCount</code>, <code class="language-plaintext highlighter-rouge">CacheSizeKiB</code>).</li>
  <li><strong><code class="language-plaintext highlighter-rouge">StylesheetCachingSummary2.xml</code></strong> — per-XMLManager stylesheet cache (<code class="language-plaintext highlighter-rouge">CacheCount</code>, <code class="language-plaintext highlighter-rouge">CacheKBCount</code>).</li>
</ul>

<p>Example <code class="language-plaintext highlighter-rouge">DomainsMemoryStatus2.xml</code> entry:</p>

<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;DomainsMemoryStatus2&gt;</span>
  <span class="nt">&lt;Domain&gt;</span>apiconnect<span class="nt">&lt;/Domain&gt;</span>
  <span class="nt">&lt;ServicesCurrent&gt;</span>0<span class="nt">&lt;/ServicesCurrent&gt;</span>
  <span class="nt">&lt;ServicesOneMinute&gt;</span>0<span class="nt">&lt;/ServicesOneMinute&gt;</span>
  <span class="nt">&lt;ServicesFiveMinutes&gt;</span>0<span class="nt">&lt;/ServicesFiveMinutes&gt;</span>
  <span class="nt">&lt;ServicesTenMinutes&gt;</span>0<span class="nt">&lt;/ServicesTenMinutes&gt;</span>
  <span class="nt">&lt;ServicesOneHour&gt;</span>0<span class="nt">&lt;/ServicesOneHour&gt;</span>
  <span class="nt">&lt;ServicesTwelveHours&gt;</span>0<span class="nt">&lt;/ServicesTwelveHours&gt;</span>
  <span class="nt">&lt;ServicesOneDay&gt;</span>0<span class="nt">&lt;/ServicesOneDay&gt;</span>
  <span class="nt">&lt;ServicesLifetime&gt;</span>0<span class="nt">&lt;/ServicesLifetime&gt;</span>
  <span class="nt">&lt;DocumentCaches&gt;</span>0<span class="nt">&lt;/DocumentCaches&gt;</span>
  <span class="nt">&lt;StylesheetCaches&gt;</span>0<span class="nt">&lt;/StylesheetCaches&gt;</span>
<span class="nt">&lt;/DomainsMemoryStatus2&gt;</span>
</code></pre></div></div>

<p>If <code class="language-plaintext highlighter-rouge">ServicesLifetime</code> is growing steadily while <code class="language-plaintext highlighter-rouge">ServicesCurrent</code> is stable and traffic is flat, it may indicate configuration growth or cache accumulation in that domain — but confirm against system-level memory trends in <code class="language-plaintext highlighter-rouge">MemoryStatus2.xml</code> before concluding it is a leak. A genuine memory leak will not be visible here.</p>

<h2 id="3-cpu-spikes-three-most-common-causes">3. CPU Spikes: Three Most Common Causes</h2>

<p><strong>Cause 1: Burst traffic</strong></p>

<p>A sudden increase in API calls — a batch job starting, a partner system spiking — will drive CPU up as DataPower processes the requests. Correlate the spike with request logs showing increased traffic volume. If it subsides when the burst ends, it is normal.</p>

<p><strong>Cause 2: Large payload processing</strong></p>

<p>Multi-megabyte XML or JSON payloads (common in B2B and file transfer APIs) cause brief CPU spikes during parsing, validation, and transformation. Use <code class="language-plaintext highlighter-rouge">show statistics</code> to check global connection counts and correlate with the spike. This is expected for large payloads, but becomes a problem if partners start sending payloads above your configured limits.</p>

<p><strong>Cause 3: First-call XSLT/GatewayScript compilation</strong></p>

<p>The first call after a domain restart or a new deployment compiles XSLT stylesheets and GatewayScript modules. Compilation is CPU-intensive. Subsequent calls use the cached version and are significantly faster. If the spike happens once and does not recur, this is the cause. If it happens repeatedly, the compilation cache is too small.</p>

<p><strong>Collecting CPU data for a support case:</strong></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Firmware version — include in every support case</span>
show version

<span class="c"># System identity, serial number, uptime</span>
show system

<span class="c"># Global statistics (CPU over 10s/1m/10m/1h/24h, connection counts,</span>
<span class="c"># memory, stylesheet compilation times) — requires statistics collection enabled</span>
show statistics

<span class="c"># CPU usage intervals (10s / 1m / 10m / 1h / 24h)</span>
show cpu

<span class="c"># Current memory usage (system-level)</span>
show memory

<span class="c"># TCP connection summary — often more revealing for CPU cases than anything else</span>
show tcp-conn

<span class="c"># Full TCP connection table</span>
show tcp-table
</code></pre></div></div>

<blockquote>
  <p><strong>Note:</strong> <code class="language-plaintext highlighter-rouge">show statistics</code> and <code class="language-plaintext highlighter-rouge">show cpu</code> are global commands — they do not accept a <code class="language-plaintext highlighter-rouge">domain</code> parameter. Per-domain memory metrics are in the error report’s <code class="language-plaintext highlighter-rouge">DomainsMemoryStatus2.xml</code>.</p>
</blockquote>

<h2 id="4-what-to-collect-before-opening-a-performance-support-case">4. What to Collect Before Opening a Performance Support Case</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Generate error report</span>
generate error-report

<span class="c"># Key files to inspect:</span>
<span class="c"># - MemoryStatus2.xml              — system memory (Usage, AvailableMemory, UsedMemory, TotalMemory)</span>
<span class="c"># - DomainsMemoryStatus2.xml       — per-domain memory (ServicesOneDay, ServicesLifetime, DocumentCaches)</span>
<span class="c"># - SystemUsage.xml                — CPU load (Load field, 0–100 scale)</span>
<span class="c"># - DocumentCachingSummary.xml     — document cache per XMLManager (DocCount, CacheSizeKiB)</span>
<span class="c"># - StylesheetCachingSummary2.xml  — stylesheet cache per XMLManager (CacheCount, CacheKBCount)</span>
<span class="c"># - HTTPConnections.xml            — HTTP connection pool stats (reqTenSec through reqOneDay)</span>
</code></pre></div></div>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>show memory
show statistics
show cpu
show tcp-conn
show tcp-table
generate error-report
<span class="c"># Then inspect DomainsMemoryStatus2.xml for per-domain memory counters.</span>
<span class="c"># Remember: genuine leaks will not appear in per-domain figures — use MemoryStatus2.xml.</span>
</code></pre></div></div>

<blockquote>
  <p><strong>ExtLatency:</strong> If the problem is performance (latency, slow response times) rather than a memory leak, enable <strong>Extended Transaction Logging (ExtLatency)</strong> before collecting further data. This is not enabled by default but is the single most useful data source for diagnosing latency problems. Enable it under <strong>Administration → Device → Extended Transaction Logging</strong> in the WebGUI, or via the CLI in the relevant domain.</p>
</blockquote>

<blockquote>
  <p><strong>Note:</strong> <code class="language-plaintext highlighter-rouge">show domain-memory</code>, <code class="language-plaintext highlighter-rouge">show connections</code>, <code class="language-plaintext highlighter-rouge">show cpu domain all</code>, and <code class="language-plaintext highlighter-rouge">show xml-managers</code> are not valid standalone CLI commands. Use <code class="language-plaintext highlighter-rouge">show statistics</code> for global connection counts, <code class="language-plaintext highlighter-rouge">show cpu</code> for CPU intervals, and the error report for per-domain detail.</p>
</blockquote>

<h2 id="5-how-datapower-throttles-under-memory-pressure">5. How DataPower Throttles Under Memory Pressure</h2>

<p>When memory runs low, DataPower engages a throttling mechanism before it reaches a critical state. There are three thresholds to understand (<a href="https://www.ibm.com/docs/en/datapower-gateway/10.6.0?topic=management-memory">IBM docs: Memory Management</a>):</p>

<p><strong>Throttle At (% memory remaining)</strong>
When available memory drops to this percentage, DataPower begins denying new incoming connections. It is not dropping traffic arbitrarily — it is buying the appliance time to complete the work already in flight and reclaim memory back below the threshold. Existing connections continue to be processed normally.</p>

<p><strong>Timeout</strong>
Once throttling begins, this is the window DataPower has to recover. If available memory does not climb back above the Throttle At threshold within this time, DataPower performs a <strong>Throttler Reload</strong> — a controlled firmware restart. The purpose is graceful recovery: completing or draining in-flight transactions, preserving data integrity, and returning the appliance to a known-good state.</p>

<p><strong>Terminate At (% memory remaining)</strong>
A hard safety net. If memory continues to fall below this value even while throttling is active, DataPower does not wait for the timeout — it starts the Throttler Reload immediately. This guards against runaway memory growth that throttling alone cannot stop.</p>

<p>The Throttler Reload is not a crash — it is a deliberate, controlled action to protect the appliance and its data. The sequence is: throttle → allow time to recover → reload if recovery fails or if memory hits the hard limit.</p>

<p>Configure these thresholds in the WebGUI under <strong>Administration → Device → Memory Management</strong> (<a href="https://www.ibm.com/docs/en/datapower-gateway/10.6.0?topic=management-configuring-memory-thresholds">IBM docs: Configuring memory thresholds</a>).</p>

<h2 id="6-performance-tuning-levers">6. Performance Tuning Levers</h2>

<p><strong>Document cache sizing:</strong></p>

<p>Configure via <strong>Objects → XML Manager → [your XML manager] → Document Cache</strong> in the WebGUI, or via the CLI in the relevant domain context. Tune the maximum number of cached entries and the TTL. High first-call latency with low subsequent latency means the cache is too small. Memory growing without traffic growth means the TTL is too long.</p>

<p><strong>Connection pool configuration:</strong></p>

<p>Set per Multi-Protocol Gateway or HTTP Front Side Handler. The defaults are tuned for balanced workloads. Only change them if you have evidence of pool exhaustion — look for <code class="language-plaintext highlighter-rouge">connection refused</code> or <code class="language-plaintext highlighter-rouge">connection pool full</code> errors in the DataPower log.</p>

<p><strong>Thread count:</strong></p>

<p>Do not change thread count without IBM guidance. Increasing beyond firmware-recommended values can decrease performance through excessive context switching.</p>

<h2 id="7-five-questions-before-you-call-ibm">7. Five Questions Before You Call IBM</h2>

<ol>
  <li>Is the appliance still processing traffic? If yes, are response times degraded or is it fully functional? Get the exact numbers before and after.</li>
  <li>What changed immediately before the issue started? New API, firmware upgrade, configuration change, traffic pattern change?</li>
  <li>Is the issue on one appliance or both in the HA pair? If one, is it primary or secondary? What does HA status show?</li>
  <li>Is Available memory decreasing consistently day-over-day, or has it plateaued? Provide a graph over at least 48 hours.</li>
  <li>What error messages appear in the DataPower logs? Export the relevant entries. Never describe errors — show them.</li>
</ol>

<p>Screenshots of CPU and memory graphs are worth more than written descriptions.</p>]]></content><author><name>[&quot;ChrisPhillips&quot;, &quot;IBMBob&quot;]</name></author><category term="DataPower" /><category term="DataPower" /><category term="Performance" /><category term="Memory" /><category term="Troubleshooting" /><category term="Firmware" /><summary type="html"><![CDATA[A practical guide to DataPower memory and CPU performance covering normal baselines, leak detection, CPU spike analysis, and performance troubleshooting triage.]]></summary></entry><entry><title type="html">Simplify API Problem Determination with AI Insights and Enriched Analytics in API Connect v12.1.1</title><link href="https://chrisphillips-cminion.github.io/apiconnect/2026/07/17/90-ai-insights-api-problem-determination-apic.html" rel="alternate" type="text/html" title="Simplify API Problem Determination with AI Insights and Enriched Analytics in API Connect v12.1.1" /><published>2026-07-17T10:00:00+00:00</published><updated>2026-07-17T10:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/apiconnect/2026/07/17/90-ai-insights-api-problem-determination-apic</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/apiconnect/2026/07/17/90-ai-insights-api-problem-determination-apic.html"><![CDATA[<p>When an API starts failing or slowing down, problem determination usually means checking several data sources and trying to build a timeline from them. API Connect v12.1.1 uses AI Insights to make that initial investigation easier.</p>

<p>Depending on the report and deployment, v12.1.1 may also expose more event detail than earlier reporting views. That gives the operator more context to work with before reviewing the AI-generated summary.</p>

<p>This article covers how AI Insights can be used during problem determination and how the extra event context can help.</p>

<!--more-->

<h2 id="the-problem">The Problem</h2>

<p>When something goes wrong with an API, you’re typically pulling from several sources at once:</p>

<ul>
  <li><strong>Gateway logs</strong>: backend response times, protocol-level errors</li>
  <li><strong>Analytics events</strong>: who called what, when, at what rate</li>
  <li><strong>Backend telemetry</strong>: your own service health metrics</li>
  <li><strong>Consumer reports</strong>: usually vague — “it’s slow” or “it’s not working”</li>
</ul>

<p>Correlating those sources takes time. Even with good tooling, the context-switching overhead is significant.</p>

<p>AI Insights acts as a first-pass investigator. It ingests the event data available in API Connect and synthesises a structured narrative: what changed, when, what else was happening at the same time, and what the likely cause is.</p>

<h2 id="how-ai-insights-analyses-events">How AI Insights Analyses Events</h2>

<p>When you open the AI Insights panel for a set of filtered events, it runs several types of analysis:</p>

<p><strong>Baseline comparison</strong> — compares current metrics against historical baselines for the same API, plan, and application. A jump from 0.1% to 5% error rate gets flagged immediately.</p>

<p><strong>Temporal correlation</strong> — looks for correlated events across dimensions. If latency spiked at the same time a specific backend returned errors, it surfaces that correlation rather than making you discover it manually.</p>

<p><strong>Anomaly classification</strong> — classifies anomalies into categories: backend latency regression, auth/authorisation issues, rate limit violations, schema validation failures, upstream timeouts. Each classification includes a confidence score.</p>

<p><strong>Root cause signalling</strong> — attempts to identify the most likely root cause category. Not a guaranteed diagnosis — a strongly informed hypothesis that directs the investigation.</p>

<h2 id="from-raw-events-to-structured-insight">From Raw Events to Structured Insight</h2>

<p>Here’s what the raw gateway log for a failing <code class="language-plaintext highlighter-rouge">/orders</code> endpoint might look like:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>2026-07-12 08:14:23.441 [gateway] HTTP 500 — POST /orders
  backend_latency=4521ms upstream_timeout
2026-07-12 08:14:25.112 [gateway] HTTP 500 — POST /orders
  backend_latency=4301ms upstream_timeout
2026-07-12 08:14:27.003 [gateway] HTTP 504 — POST /orders
  gateway_timeout
</code></pre></div></div>

<p>The same data expressed as an AI-generated summary:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>🔴 [CRITICAL] Upstream Service Degradation Detected — /orders

8 timeout errors (HTTP 500/504) in the past 12 minutes.
Average backend response time: 4,380ms (vs. baseline of 230ms).
All failures are POST /orders operations.
Correlated event: Backend /order-service health endpoint returned
HTTP 503 at 08:14 UTC.

Likely root cause: Upstream order service is overloaded or unreachable.
Recommended:
  1. Check order-service pod/container health in your backend cluster
  2. Review recent deployments to order-service
  3. Consider temporary rate limiting on /orders to protect the backend
</code></pre></div></div>

<h2 id="an-investigation-walkthrough">An Investigation Walkthrough</h2>

<p>A consumer reports: “Our application is getting errors on the <code class="language-plaintext highlighter-rouge">/payments</code> endpoint since this morning.”</p>

<ol>
  <li>Open API Analytics for <code class="language-plaintext highlighter-rouge">/payments</code>, time range: today.</li>
  <li>Open the AI Insights panel. It shows:
    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>⚠️ [WARNING] Validation Error Spike on /payments
POST requests with content-type application/json have returned 400 errors
at 3.2x the normal rate since 2026-07-12 06:00 UTC.
Error body: "card_number: must be a 16-digit string" —
suggests a schema validation change was published.
</code></pre></div>    </div>
  </li>
  <li>Check the API definition — a schema update was published at 06:00 UTC.</li>
  <li>Notify the consumer: they need to update their payload format.</li>
</ol>

<p>Under 2 minutes instead of 20.</p>

<h2 id="example-investigating-an-error-spike">Example: Investigating an Error Spike</h2>

<p>Let’s walk through a more complete example:</p>

<ol>
  <li><strong>Alert fires</strong>: PagerDuty wakes you at 03:00 — error rate above threshold on production.</li>
  <li><strong>Open API Manager → Analytics → API Health</strong>: You see an error spike on several endpoints.</li>
  <li><strong>Open AI Insights panel</strong>: It immediately shows:
    <ul>
      <li>Primary insight: “Backend database connection pool exhaustion detected”</li>
      <li>Supporting detail: “Error pattern matches known ‘connection timeout’ signature”</li>
      <li>Recommended action: “Check database max_connections and active connection count”</li>
    </ul>
  </li>
  <li><strong>Confirm</strong>: You check your PostgreSQL instance — sure enough, connections are maxed.</li>
  <li><strong>Remediate</strong>: You kill idle connections and temporarily increase the pool limit.</li>
  <li><strong>Compare outcome to insight</strong>: After the incident, compare the actual resolution with the suggested cause to judge how useful the insight was.</li>
</ol>

<h2 id="limitations-and-notes">Limitations and Notes</h2>

<ul>
  <li><strong>AI Insights augments, not replaces, your expertise</strong>. Always validate insights against your actual systems before taking action.</li>
  <li><strong>Requires v12.1.1.0</strong> — this feature is not backported to earlier v12 versions.</li>
  <li><strong>Baselines need time to establish</strong> — AI Insights is most powerful after your APIs have been running for at least 1-2 weeks.</li>
  <li><strong>Not a real-time incident management tool</strong> — for PagerDuty-class alerting, configure the Alerts feature in API Manager separately. AI Insights is for interactive investigation.</li>
  <li><strong>Environment-specific requirements</strong>: Exact availability and runtime dependencies may vary by deployment model. Check the IBM documentation for your specific environment.</li>
</ul>

<h2 id="summary">Summary</h2>

<p>API Connect v12.1.1 improves problem determination on two fronts. First, the analytics experience may expose richer event context than earlier views, giving operators more raw material to investigate with even without any AI involvement. Second, <strong>AI Insights</strong> can help synthesise that data into a structured narrative: what changed, when, what else was happening, and what the likely cause may be.</p>

<p>Together these two improvements take the tedious work out of the initial investigation phase — correlating events, surfacing anomalies, and pointing you toward likely causes — so you spend your time fixing problems rather than hunting for them.</p>

<p>If you’re on v12.1.1, take it for a spin next time something goes wrong. You might find your mean time to resolution drops noticeably.</p>]]></content><author><name>[&quot;ChrisPhillips&quot;, &quot;IBMBob&quot;]</name></author><category term="APIConnect" /><summary type="html"><![CDATA[When an API starts failing or slowing down, problem determination usually means checking several data sources and trying to build a timeline from them. API Connect v12.1.1 uses AI Insights to make that initial investigation easier. Depending on the report and deployment, v12.1.1 may also expose more event detail than earlier reporting views. That gives the operator more context to work with before reviewing the AI-generated summary. This article covers how AI Insights can be used during problem determination and how the extra event context can help.]]></summary></entry><entry><title type="html">AI Insights for Analytics Reports in IBM API Connect v12.1.1</title><link href="https://chrisphillips-cminion.github.io/apiconnect/2026/07/15/90-ai-insights-analytics-reports-apic.html" rel="alternate" type="text/html" title="AI Insights for Analytics Reports in IBM API Connect v12.1.1" /><published>2026-07-15T09:00:00+00:00</published><updated>2026-07-15T09:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/apiconnect/2026/07/15/90-ai-insights-analytics-reports-apic</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/apiconnect/2026/07/15/90-ai-insights-analytics-reports-apic.html"><![CDATA[<p>API Connect analytics reports show a lot of data, but the harder part is understanding what it means. AI Insights is intended to help with that by turning report data into short explanations and recommendations.</p>

<p>This article covers what AI Insights is, where it appears in reporting, and the kind of output it can provide.</p>

<!--more-->

<h2 id="what-is-ai-insights">What is AI Insights?</h2>

<p>AI Insights is embedded in the API Connect v12.1.1 analytics reporting framework. Instead of presenting raw event counts and charts for you to interpret, it analyses your API traffic patterns, error distributions, latency trends, and subscription behaviour, then generates natural-language summaries and recommended actions.</p>

<h2 id="how-it-works-in-the-reporting-experience">How It Works in the Reporting Experience</h2>

<p>When you open any analytics report in API Connect v12.1.1 — API Usage, Application Activity, Plan Performance — an <strong>AI Insights</strong> panel appears at the top of the report view. It generates on demand based on the current filter context: time range, API, plan, application.</p>

<p>The panel analyses:</p>
<ul>
  <li>Historical baseline metrics for the same API/plan/application</li>
  <li>Cross-dimensional correlations (error spikes against specific time windows or backend latencies)</li>
  <li>Historical behaviour visible in the analytics dataset</li>
</ul>

<p>Results appear as a scrolling list of insight cards, each with a plain-language title, a severity indicator (Info, Warning, Critical), a brief explanation, and a recommended action where applicable.</p>

<h2 id="practical-examples">Practical Examples</h2>

<p>Here are examples of the kind of insight AI Insights can generate:</p>

<h3 id="elevated-error-rate">Elevated Error Rate</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>⚠️ [WARNING] Elevated 5xx Error Rate on /payments/refund
Detected: 5xx errors increased by 340% compared to the 7-day baseline
(from avg 0.3% to 13.2%) starting 2026-07-10 14:00 UTC.
Likely cause: Backend service latency spike detected on the same timeline.
Recommended: Check backend /payments service health and recent deployments.
</code></pre></div></div>

<h3 id="unusual-application-traffic">Unusual Application Traffic</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ℹ️ [INFO] Traffic Spike for Application "mobile-banking-app"
Detected: Outbound call volume exceeded 2x its typical daily peak
at 2026-07-11 09:15 UTC. Coincides with a referrer pattern shift.
Consider: Reviewing rate limit configuration for this plan.
</code></pre></div></div>

<h3 id="orphaned-subscriptions">Orphaned Subscriptions</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ℹ️ [INFO] Plan "/standard" subscriptions have migrated
23% of applications on the /standard plan have not called any API
operation in 14+ days. These subscriptions may be orphaned.
Recommended: Review subscription health as part of your quarterly API review.
</code></pre></div></div>

<h3 id="latency-regression">Latency Regression</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>🔴 [CRITICAL] P99 Latency Regression on /forex/rates
P99 latency increased from ~120ms to ~2.1s over the past 48 hours — a 17x degradation.
Affected: 1,240 requests in the past hour.
Recommended: Investigate backend service changes, database query performance,
or network path changes immediately.
</code></pre></div></div>

<h2 id="accessing-ai-insights">Accessing AI Insights</h2>

<ol>
  <li>Log into <strong>API Manager</strong></li>
  <li>Navigate to <strong>Analytics</strong> → <strong>[Select Report Type]</strong></li>
  <li>Apply your filters (time range, API, plan, application)</li>
  <li>The <strong>AI Insights</strong> panel appears at the top of the report</li>
</ol>

<h2 id="requirements">Requirements</h2>

<ul>
  <li><strong>Minimum version</strong>: API Connect v12.1.1.0 (GA June 2026). Not available in earlier v12 releases.</li>
  <li><strong>Analytics data required</strong>: Needs at least 7 days of traffic to establish baselines — won’t generate insights on a new installation.</li>
  <li><strong>Not real-time alerting</strong>: Insights are generated when you open a report, not pushed proactively. For real-time alerting, use the Alerts configuration in API Manager.</li>
  <li><strong>Deployment-specific</strong>: Exact availability and runtime dependencies vary by deployment model and entitlement. Check IBM documentation for your environment before relying on the feature.</li>
  <li><strong>Interpretive, not deterministic</strong>: Always validate against your actual systems before acting on a recommendation.</li>
</ul>

<hr />
<p><em>Next: “Simplify API Problem Determination with AI Insights” — using AI Insights during a live incident investigation.</em></p>]]></content><author><name>[&quot;ChrisPhillips&quot;, &quot;IBMBob&quot;]</name></author><category term="APIConnect" /><category term="APIConnect" /><category term="APIConnectv12" /><category term="Analytics" /><category term="AIInsights" /><category term="Reporting" /><summary type="html"><![CDATA[Discover how AI Insights transforms raw API analytics data into actionable intelligence within the API Connect reporting experience.]]></summary></entry><entry><title type="html">API Connect v12.1.1 LTS — What’s New and Why It Matters</title><link href="https://chrisphillips-cminion.github.io/apiconnect/2026/07/13/95-apic-v12110-lts-whats-new.html" rel="alternate" type="text/html" title="API Connect v12.1.1 LTS — What’s New and Why It Matters" /><published>2026-07-13T09:00:00+00:00</published><updated>2026-07-13T09:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/apiconnect/2026/07/13/95-apic-v12110-lts-whats-new</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/apiconnect/2026/07/13/95-apic-v12110-lts-whats-new.html"><![CDATA[<p>IBM API Connect v12.1.1.0 is positioned as a <strong>Long-Term Support (LTS)</strong> release. If you are planning production upgrades, that makes it a version worth reviewing closely.</p>

<p>This article summarises the main themes in v12.1.1.0 and the areas worth checking in the IBM documentation.</p>

<!--more-->

<h2 id="table-of-contents">Table of Contents</h2>

<ol>
  <li><a href="#what-is-an-lts-release">What Is an LTS Release?</a></li>
  <li><a href="#v12110-release-date-and-support-lifecycle">v12.1.1.0 Release Date and Support Lifecycle</a></li>
  <li><a href="#key-themes-of-v12110">Key Themes of v12.1.1.0</a></li>
  <li><a href="#ai-driven-insights">AI-Driven Insights</a></li>
  <li><a href="#governance-automation">Governance Automation</a></li>
  <li><a href="#developer-experience-improvements">Developer Experience Improvements</a></li>
  <li><a href="#other-notable-changes">Other Notable Changes</a></li>
  <li><a href="#should-you-upgrade">Should You Upgrade?</a></li>
  <li><a href="#ibm-documentation-links">IBM Documentation Links</a></li>
</ol>

<p>v12.1.1.0 is an LTS release, which means it’s the recommended target for new production deployments and upgrades from earlier versions.</p>

<h2 id="v12110-release-date-and-support-lifecycle">v12.1.1.0 Release Date and Support Lifecycle</h2>

<ul>
  <li><strong>Release timing</strong>: Confirm the official GA date in the IBM release notes for v12.1.1.0</li>
  <li><strong>End of Support</strong>: See <a href="https://www.ibm.com/software/support/lifecycle/">IBM software lifecycle</a> — search for API Connect v12.1.1</li>
  <li><strong>Supported upgrade sources</strong>: Confirm the supported source versions in the IBM upgrade documentation before planning the path</li>
</ul>

<h2 id="key-themes-of-v12110">Key Themes of v12.1.1.0</h2>

<p>The v12.1.1.0 LTS release is defined by three major themes:</p>

<ol>
  <li><strong>AI-driven operational insights</strong> — making analytics data actionable without requiring deep expertise</li>
  <li><strong>Governance automation</strong> — scheduled scans, rule sets, and CI/CD integration</li>
  <li><strong>Developer experience</strong> — improvements across the CMS Portal, subscription workflows, and documentation rendering</li>
</ol>

<h2 id="ai-driven-insights">AI-Driven Insights</h2>

<p>This release highlights AI Insights across two key surfaces:</p>

<h3 id="ai-insights-in-analytics-reports">AI Insights in Analytics Reports</h3>

<p>The analytics reporting experience now includes AI-generated summaries of what the data shows. Rather than staring at charts and trying to interpret them, users get plain-language explanations of trends, anomalies, and recommended actions.</p>

<h3 id="what-this-means-for-you">What This Means for You</h3>

<ul>
  <li>Junior API ops engineers can make better decisions faster</li>
  <li>Experienced engineers spend less time on initial triage</li>
  <li>API programme managers get more value from analytics without needing deep technical training</li>
</ul>

<h2 id="governance-automation">Governance Automation</h2>

<p>The governance story in v12.1.1.0 appears substantially stronger:</p>

<h3 id="scheduled-governance-scans">Scheduled Governance Scans</h3>

<p>You can attach recurring schedules to governance rule sets so scans run automatically at defined intervals and results are stored in governance history. In practice, that shifts governance from an occasional manual check toward a more continuous model.</p>

<h3 id="governance-as-code-enhancements">Governance as Code Enhancements</h3>

<p>The <code class="language-plaintext highlighter-rouge">apic governance</code> CLI can be used to create, update, and run governance rule sets programmatically, which makes CI/CD integration more practical:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Run a compliance scan as part of CI/CD (requires -m governance mode)</span>
apic <span class="nt">-m</span> governance compliance:scan <span class="se">\</span>
  <span class="nt">--server</span> <span class="k">${</span><span class="nv">MANAGEMENT_SERVER</span><span class="k">}</span> <span class="se">\</span>
  <span class="nt">--org</span> <span class="k">${</span><span class="nv">PROVIDER_ORG</span><span class="k">}</span> <span class="se">\</span>
  <span class="nt">--catalog</span> <span class="k">${</span><span class="nv">CATALOG</span><span class="k">}</span> <span class="se">\</span>
  <span class="nt">--scope</span> catalog <span class="se">\</span>
  compliance-request.yaml

<span class="c"># Check for violations in the scan report</span>
<span class="k">if</span> <span class="o">[</span> <span class="nv">$?</span> <span class="nt">-ne</span> 0 <span class="o">]</span><span class="p">;</span> <span class="k">then
  </span><span class="nb">echo</span> <span class="s2">"Governance violations detected — failing build"</span>
  <span class="nb">exit </span>1
<span class="k">fi</span>
</code></pre></div></div>

<h3 id="what-this-means-for-you-1">What This Means for You</h3>

<ul>
  <li>Governance that scales with your API portfolio</li>
  <li>Audit trail of governance compliance over time</li>
  <li>Integration with decentralised API development (not just team-managed APIs)</li>
</ul>

<h2 id="developer-experience-improvements">Developer Experience Improvements</h2>

<h3 id="cms-portal-dark-mode">CMS Portal Dark Mode</h3>

<p>The CMS Portal adds dark-mode theming support so custom themes can define both light and dark palettes.</p>

<h3 id="subscription-wizard-tos-support">Subscription Wizard ToS Support</h3>

<p>Terms of Service acknowledgement is part of the subscription wizard workflow, allowing versioned ToS documents to be attached to plans and acknowledged during subscription.</p>

<h3 id="openapi-31-support">OpenAPI 3.1 Support</h3>

<p>OpenAPI 3.1 support is called out as a notable platform capability, including Developer Portal rendering.</p>

<h2 id="other-notable-changes">Other Notable Changes</h2>

<h3 id="scheduled-analytics-reports">Scheduled Analytics Reports</h3>

<p>Scheduled generation and delivery of analytics reports.</p>

<h3 id="usage-evolution-report">Usage Evolution Report</h3>

<p>A usage-evolution style analytics report showing how programme metrics change over time.</p>

<h3 id="subscription-migration-improvements">Subscription Migration Improvements</h3>

<p>Subscription migration improvements include better visibility into subscriptions that need migration and support for bulk migration workflows.</p>

<h3 id="api-analytics-mcp-server-preview">API Analytics MCP Server (Preview)</h3>

<p>A preview Model Context Protocol server for querying API Connect analytics data programmatically.</p>

<h2 id="should-you-upgrade">Should You Upgrade?</h2>

<p>If you’re running an earlier version of API Connect and you’re on a supported upgrade path to v12.1.1.0, this LTS is worth serious consideration. Before planning the move, confirm your exact supported source version in the IBM upgrade documentation.</p>

<p>If you’re already on v12 (non-LTS CD release), you should review the specific changes between your current version and 12.1.1.0 to determine if the LTS certification is important for your timeline.</p>

<p><strong>General guidance:</strong></p>
<ul>
  <li><strong>New deployments</strong>: Consider v12.1.1.0 LTS if it matches your support and lifecycle goals</li>
  <li><strong>Existing v10/v11 production</strong>: Review the supported upgrade path and plan accordingly</li>
  <li><strong>Existing v12 CD</strong>: Evaluate whether moving to the LTS line matters for your support model and release cadence</li>
</ul>

<p>Always test in a non-production environment before upgrading production.</p>

<h2 id="ibm-documentation-links">IBM Documentation Links</h2>

<ul>
  <li><strong>Main v12.1.1 documentation</strong>: <a href="https://www.ibm.com/docs/en/api-connect/software/12.1.1">https://www.ibm.com/docs/en/api-connect/software/12.1.1</a></li>
  <li><strong>What’s New in v12.1.1</strong>: Use the official IBM “What’s New” documentation for the final feature list</li>
  <li><strong>LTS lifecycle</strong>: <a href="https://www.ibm.com/software/support/lifecycle/">IBM API Connect support lifecycle</a> (search for API Connect)</li>
</ul>

<h2 id="summary">Summary</h2>

<p>API Connect v12.1.1.0 LTS looks like an important release for teams focused on operational visibility, governance, and developer experience. The combination of AI-backed analytics features, governance automation, and portal improvements makes it worth close review for most API Connect operators.</p>

<p>If you’re planning an API Connect deployment or upgrade in 2026, treat v12.1.1.0 LTS as a version to evaluate seriously — but confirm the exact feature set, support dates, and upgrade path in the IBM documentation before committing.</p>]]></content><author><name>ChrisPhillips</name></author><category term="APIConnect" /><category term="APIConnect" /><category term="APIConnectv12" /><category term="LTS" /><category term="ReleaseNotes" /><summary type="html"><![CDATA[A summary of the IBM API Connect v12.1.1.0 LTS release (GA June 2026), covering AI-driven insights, governance automation, and developer experience improvements.]]></summary></entry><entry><title type="html">Configuring TLS Client Profiles in DataPower CLI</title><link href="https://chrisphillips-cminion.github.io/datapower/2026/03/10/datapower-tls-client-profile-cli.html" rel="alternate" type="text/html" title="Configuring TLS Client Profiles in DataPower CLI" /><published>2026-03-10T14:00:00+00:00</published><updated>2026-03-10T14:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/datapower/2026/03/10/datapower-tls-client-profile-cli</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/datapower/2026/03/10/datapower-tls-client-profile-cli.html"><![CDATA[<p>When working with DataPower, configuring TLS client profiles through the CLI provides a fast and scriptable way to manage SSL/TLS settings for downstream connections. This article demonstrates how to configure TLS client profiles using the DataPower command-line interface, including protocol versions and cipher suite selection.</p>

<!--more-->

<h2 id="what-is-a-tls-client-profile">What is a TLS Client Profile?</h2>

<p>A TLS client profile in DataPower defines the SSL/TLS settings used when DataPower acts as a client connecting to downstream (backend) services. This includes:</p>

<ul>
  <li><strong>TLS protocol versions</strong> - Which versions of TLS to support (TLS 1.2, TLS 1.3, etc.)</li>
  <li><strong>Cipher suites</strong> - The encryption algorithms to use for secure communication</li>
  <li><strong>Certificate validation</strong> - How to verify server certificates</li>
  <li><strong>Client authentication</strong> - Optional client certificate settings</li>
</ul>

<h2 id="basic-cli-configuration">Basic CLI Configuration</h2>

<p>Here’s the basic command structure to configure a TLS client profile in the DataPower CLI:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>top <span class="p">;</span> sw domainname <span class="p">;</span> co <span class="p">;</span> crypto <span class="p">;</span> ssl-client downstreamprofile
    protocols TLSv1d2+TLSv1d3
    ciphers AES_256_GCM_SHA384
    ciphers AES_128_GCM_SHA256
    ciphers AES_128_CCM_SHA256
    ciphers AES_128_CCM_8_SHA256
<span class="nb">exit</span> <span class="p">;</span> <span class="nb">exit</span> <span class="p">;</span> 
</code></pre></div></div>

<p>Exit is needed twice to leave both <code class="language-plaintext highlighter-rouge">crypto</code> and <code class="language-plaintext highlighter-rouge">co</code></p>

<p>Let’s break down each component:</p>

<h3 id="1-creating-the-profile">1. Creating the Profile</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssl-client downstreamprofile
</code></pre></div></div>

<p>This command creates (or modifies) an SSL client profile named <code class="language-plaintext highlighter-rouge">downstreamprofile</code>. The name can be any valid identifier that describes your use case.</p>

<p><strong>Important</strong>: You can create a TLS client profile through the WebGUI by searching for “tls client” or via CLI as shown above.</p>

<h3 id="2-setting-protocol-versions">2. Setting Protocol Versions</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>protocols TLSv1d2+TLSv1d3
</code></pre></div></div>

<p>This line configures which TLS protocol versions are allowed:</p>

<ul>
  <li><strong><code class="language-plaintext highlighter-rouge">TLSv1d2</code></strong> - Enables TLS 1.2</li>
  <li><strong><code class="language-plaintext highlighter-rouge">TLSv1d3</code></strong> - Enables TLS 1.3</li>
  <li><strong><code class="language-plaintext highlighter-rouge">+</code></strong> - The plus sign means “and”, allowing both protocols</li>
</ul>

<p><strong>Note</strong>: DataPower uses <code class="language-plaintext highlighter-rouge">d</code> instead of <code class="language-plaintext highlighter-rouge">.</code> in protocol version names (e.g., <code class="language-plaintext highlighter-rouge">TLSv1d2</code> instead of <code class="language-plaintext highlighter-rouge">TLSv1.2</code>).</p>

<p><strong>Common Protocol Options</strong>:</p>
<ul>
  <li><code class="language-plaintext highlighter-rouge">TLSv1d2</code> - TLS 1.2 only</li>
  <li><code class="language-plaintext highlighter-rouge">TLSv1d3</code> - TLS 1.3 only</li>
  <li><code class="language-plaintext highlighter-rouge">TLSv1d2+TLSv1d3</code> - Both TLS 1.2 and 1.3</li>
  <li><code class="language-plaintext highlighter-rouge">TLSv1d0+TLSv1d1+TLSv1d2</code> - TLS 1.0, 1.1, and 1.2 <em>(not recommended for production)</em></li>
</ul>

<h3 id="3-configuring-cipher-suites">3. Configuring Cipher Suites</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ciphers AES_256_GCM_SHA384
ciphers AES_128_GCM_SHA256
ciphers AES_128_CCM_SHA256
ciphers AES_128_CCM_8_SHA256
</code></pre></div></div>

<p>Each <code class="language-plaintext highlighter-rouge">ciphers</code> line adds a cipher suite to the profile. The order matters - DataPower will prefer ciphers in the order they’re listed.</p>

<p><strong>Critical Requirement</strong>: The profile must include at least one cipher suite that matches the associated key material:</p>
<ul>
  <li>When using RSA keys or certificates, you must specify at least one RSA cipher suite</li>
  <li>When using ECDSA keys or certificates, you must specify at least one ECDSA cipher suite</li>
</ul>

<p><strong>Understanding the Cipher Names</strong>:</p>

<ul>
  <li><strong><code class="language-plaintext highlighter-rouge">AES_256_GCM_SHA384</code></strong>
    <ul>
      <li><code class="language-plaintext highlighter-rouge">AES_256</code> - AES encryption with 256-bit key</li>
      <li><code class="language-plaintext highlighter-rouge">GCM</code> - Galois/Counter Mode (authenticated encryption)</li>
      <li><code class="language-plaintext highlighter-rouge">SHA384</code> - SHA-384 hash algorithm</li>
    </ul>
  </li>
  <li><strong><code class="language-plaintext highlighter-rouge">AES_128_GCM_SHA256</code></strong>
    <ul>
      <li><code class="language-plaintext highlighter-rouge">AES_128</code> - AES encryption with 128-bit key</li>
      <li><code class="language-plaintext highlighter-rouge">GCM</code> - Galois/Counter Mode</li>
      <li><code class="language-plaintext highlighter-rouge">SHA256</code> - SHA-256 hash algorithm</li>
    </ul>
  </li>
  <li><strong><code class="language-plaintext highlighter-rouge">AES_128_CCM_SHA256</code></strong>
    <ul>
      <li><code class="language-plaintext highlighter-rouge">CCM</code> - Counter with CBC-MAC mode (authenticated encryption)</li>
    </ul>
  </li>
  <li><strong><code class="language-plaintext highlighter-rouge">AES_128_CCM_8_SHA256</code></strong>
    <ul>
      <li><code class="language-plaintext highlighter-rouge">CCM_8</code> - CCM mode with 8-byte authentication tag</li>
    </ul>
  </li>
</ul>

<h3 id="4-exiting-and-apply-configuration-mode">4. Exiting and Apply Configuration Mode</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">exit</span>
</code></pre></div></div>

<h2 id="best-practices">Best Practices</h2>

<h3 id="1-use-strong-protocols-only">1. Use Strong Protocols Only</h3>

<p>For production environments, use only TLS 1.2 and TLS 1.3:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>protocols TLSv1d2+TLSv1d3
</code></pre></div></div>

<p>Avoid older protocols like TLS 1.0 and 1.1, which have known vulnerabilities.</p>

<h3 id="2-prioritize-strong-ciphers">2. Prioritize Strong Ciphers</h3>

<p>List stronger ciphers first. GCM-based ciphers are generally preferred:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ciphers AES_256_GCM_SHA384 
ciphers AES_128_GCM_SHA256
</code></pre></div></div>

<h3 id="3-limit-cipher-suite-selection">3. Limit Cipher Suite Selection</h3>

<p>Don’t enable every available cipher. Use only those that meet your security requirements and are supported by your downstream services. Remember that the cipher suite order matters - the displayed order is the preferred order.</p>

<h3 id="4-enable-certificate-validation">4. Enable Certificate Validation</h3>

<p>Always validate server certificates in production:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>validate-server-cert on
valcred trustedCAs
</code></pre></div></div>

<p>By default, server authentication is not enabled. For production environments, you should enable server validation to ensure secure connections.</p>

<h3 id="5-use-descriptive-names">5. Use Descriptive Names</h3>

<p>Name your profiles descriptively to indicate their purpose:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssl-client backend-api-profile
ssl-client payment-gateway-profile
ssl-client internal-services-profile
</code></pre></div></div>

<h2 id="viewing-current-configuration">Viewing Current Configuration</h2>

<p>To view the current configuration of a TLS client profile:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>show ssl-client downstreamprofile
</code></pre></div></div>

<p>To see all SSL client profiles:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>show ssl-client
</code></pre></div></div>

<h2 id="additional-resources">Additional Resources</h2>
<ul>
  <li><a href="https://www.ibm.com/docs/en/datapower-gateway">IBM DataPower Gateway Documentation</a></li>
  <li><a href="https://www.ibm.com/docs/en/datapower-gateway/10.5.x?topic=profiles-creating-tls-client-profile">Creating a TLS Client Profile</a></li>
  <li><a href="https://www.ibm.com/docs/en/datapower-gateway/10.0?topic=interface-command-line">DataPower CLI Reference</a></li>
</ul>]]></content><author><name>ChrisPhillips</name></author><category term="DataPower" /><category term="DataPower" /><category term="TLS" /><category term="SSL" /><category term="CLI" /><category term="Security" /><category term="Encryption" /><category term="Ciphers" /><category term="Certificate" /><summary type="html"><![CDATA[Learn how to configure TLS client profiles in IBM DataPower using the CLI. Complete guide covering protocol versions, cipher suites, certificate validation, and best practices for secure downstream connections.]]></summary></entry><entry><title type="html">Custom Request Body Validation with GatewayScript in API Connect</title><link href="https://chrisphillips-cminion.github.io/apiconnect/2026/03/10/custom-body-validation-gatewayscript.html" rel="alternate" type="text/html" title="Custom Request Body Validation with GatewayScript in API Connect" /><published>2026-03-10T10:00:00+00:00</published><updated>2026-03-10T10:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/apiconnect/2026/03/10/custom-body-validation-gatewayscript</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/apiconnect/2026/03/10/custom-body-validation-gatewayscript.html"><![CDATA[<p>When building APIs, robust input validation is critical for security, data integrity, and providing clear error messages to API consumers. While API Connect provides built-in validation through OpenAPI schemas, sometimes you need to explan why the validation failed to the consumers. This article demonstrates how to implement custom request body validation using GatewayScript that validates against a JSON schema and returns detailed error messages for each invalid field.</p>

<!--more-->

<h2 id="the-complete-api-definition">The Complete API Definition</h2>

<p>Here’s a complete OpenAPI 2.0 (Swagger) definition that implements a flexible validation API. The key difference from traditional validation is that both the payload and schema are sent in the request body, making this a reusable validation service:</p>

<p><em>Note: the schema must be in both the spec and the gatewaysript</em></p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">swagger</span><span class="pi">:</span> <span class="s1">'</span><span class="s">2.0'</span>
<span class="na">info</span><span class="pi">:</span>
  <span class="na">title</span><span class="pi">:</span> <span class="s">Body Validation API</span>
  <span class="na">version</span><span class="pi">:</span> <span class="s">1.0.0</span>
  <span class="na">description</span><span class="pi">:</span> <span class="pi">&gt;-</span>
    <span class="s">API that validates request body against a JSON schema and returns invalid</span>
    <span class="s">fields</span>
  <span class="na">x-ibm-name</span><span class="pi">:</span> <span class="s">body-validation-api</span>
<span class="na">basePath</span><span class="pi">:</span> <span class="s">/validate</span>
<span class="na">schemes</span><span class="pi">:</span>
  <span class="pi">-</span> <span class="s">https</span>
<span class="na">consumes</span><span class="pi">:</span>
  <span class="pi">-</span> <span class="s">application/json</span>
<span class="na">produces</span><span class="pi">:</span>
  <span class="pi">-</span> <span class="s">application/json</span>
<span class="na">definitions</span><span class="pi">:</span>
  <span class="na">ValidationRequest</span><span class="pi">:</span>
    <span class="na">type</span><span class="pi">:</span> <span class="s">object</span>
    <span class="na">required</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="s">payload</span>
      <span class="pi">-</span> <span class="s">schema</span>
    <span class="na">properties</span><span class="pi">:</span>
      <span class="na">payload</span><span class="pi">:</span>
        <span class="na">type</span><span class="pi">:</span> <span class="s">object</span>
        <span class="na">description</span><span class="pi">:</span> <span class="s">The data to be validated</span>
      <span class="na">schema</span><span class="pi">:</span>
        <span class="na">type</span><span class="pi">:</span> <span class="s">object</span>
        <span class="na">description</span><span class="pi">:</span> <span class="s">JSON Schema to validate the payload against</span>
        <span class="na">properties</span><span class="pi">:</span>
          <span class="na">type</span><span class="pi">:</span>
            <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
          <span class="na">required</span><span class="pi">:</span>
            <span class="na">type</span><span class="pi">:</span> <span class="s">array</span>
            <span class="na">items</span><span class="pi">:</span>
              <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
          <span class="na">properties</span><span class="pi">:</span>
            <span class="na">type</span><span class="pi">:</span> <span class="s">object</span>
          <span class="na">additionalProperties</span><span class="pi">:</span>
            <span class="na">type</span><span class="pi">:</span> <span class="s">boolean</span>
    <span class="na">additionalProperties</span><span class="pi">:</span> <span class="no">false</span>

  <span class="na">ValidationSuccess</span><span class="pi">:</span>
    <span class="na">type</span><span class="pi">:</span> <span class="s">object</span>
    <span class="na">properties</span><span class="pi">:</span>
      <span class="na">status</span><span class="pi">:</span>
        <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
        <span class="na">example</span><span class="pi">:</span> <span class="s">success</span>
      <span class="na">message</span><span class="pi">:</span>
        <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
        <span class="na">example</span><span class="pi">:</span> <span class="s">Validation passed</span>

  <span class="na">ValidationError</span><span class="pi">:</span>
    <span class="na">type</span><span class="pi">:</span> <span class="s">object</span>
    <span class="na">properties</span><span class="pi">:</span>
      <span class="na">status</span><span class="pi">:</span>
        <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
        <span class="na">example</span><span class="pi">:</span> <span class="s">error</span>
      <span class="na">message</span><span class="pi">:</span>
        <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
        <span class="na">example</span><span class="pi">:</span> <span class="s">Validation failed</span>
      <span class="na">errors</span><span class="pi">:</span>
        <span class="na">type</span><span class="pi">:</span> <span class="s">array</span>
        <span class="na">items</span><span class="pi">:</span>
          <span class="na">type</span><span class="pi">:</span> <span class="s">object</span>
          <span class="na">properties</span><span class="pi">:</span>
            <span class="na">field</span><span class="pi">:</span>
              <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
              <span class="na">description</span><span class="pi">:</span> <span class="s">The field that failed validation</span>
            <span class="na">message</span><span class="pi">:</span>
              <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
              <span class="na">description</span><span class="pi">:</span> <span class="s">Description of the validation error</span>
            <span class="na">value</span><span class="pi">:</span>
              <span class="na">type</span><span class="pi">:</span> <span class="s">string</span>
              <span class="na">description</span><span class="pi">:</span> <span class="s">The actual value that failed validation</span>
<span class="na">paths</span><span class="pi">:</span>
  <span class="na">/user</span><span class="pi">:</span>
    <span class="na">post</span><span class="pi">:</span>
      <span class="na">summary</span><span class="pi">:</span> <span class="s">Validate user data</span>
      <span class="na">description</span><span class="pi">:</span> <span class="s">Validates user data against a provided schema</span>
      <span class="na">parameters</span><span class="pi">:</span>
        <span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">body</span>
          <span class="na">in</span><span class="pi">:</span> <span class="s">body</span>
          <span class="na">required</span><span class="pi">:</span> <span class="no">true</span>
          <span class="na">schema</span><span class="pi">:</span>
            <span class="na">$ref</span><span class="pi">:</span> <span class="s1">'</span><span class="s">#/definitions/ValidationRequest'</span>
      <span class="na">responses</span><span class="pi">:</span>
        <span class="s1">'</span><span class="s">200'</span><span class="err">:</span>
          <span class="na">description</span><span class="pi">:</span> <span class="s">Validation successful</span>
          <span class="na">schema</span><span class="pi">:</span>
            <span class="na">$ref</span><span class="pi">:</span> <span class="s1">'</span><span class="s">#/definitions/ValidationSuccess'</span>
      <span class="err">  </span><span class="s1">'</span><span class="s">400'</span><span class="err">:</span>
          <span class="na">description</span><span class="pi">:</span> <span class="s">Validation failed</span>
          <span class="na">schema</span><span class="pi">:</span>
            <span class="na">$ref</span><span class="pi">:</span> <span class="s1">'</span><span class="s">#/definitions/ValidationError'</span>
<span class="na">x-ibm-configuration</span><span class="pi">:</span>
  <span class="na">enforced</span><span class="pi">:</span> <span class="no">true</span>
  <span class="na">testable</span><span class="pi">:</span> <span class="no">true</span>
  <span class="na">phase</span><span class="pi">:</span> <span class="s">realized</span>
  <span class="na">cors</span><span class="pi">:</span>
    <span class="na">enabled</span><span class="pi">:</span> <span class="no">true</span>
  <span class="na">gateway</span><span class="pi">:</span> <span class="s">datapower-api-gateway</span>
  <span class="na">type</span><span class="pi">:</span> <span class="s">rest</span>
  <span class="na">assembly</span><span class="pi">:</span>
    <span class="na">execute</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="na">parse</span><span class="pi">:</span>
          <span class="na">version</span><span class="pi">:</span> <span class="s">2.0.0</span>
          <span class="na">title</span><span class="pi">:</span> <span class="s">Parse JSON Body</span>
          <span class="na">parse-settings-reference</span><span class="pi">:</span>
            <span class="na">default</span><span class="pi">:</span> <span class="s">apic-default-parsesettings</span>
      <span class="pi">-</span> <span class="na">gatewayscript</span><span class="pi">:</span>
          <span class="na">version</span><span class="pi">:</span> <span class="s">2.0.0</span>
          <span class="na">title</span><span class="pi">:</span> <span class="s">Handle Validation</span>
          <span class="na">source</span><span class="pi">:</span> <span class="pi">|</span>
            <span class="s">// Get the parsed request body (already parsed by the parse policy)</span>
            <span class="s">var requestBody = context.get('request.body');</span>

            <span class="s">// Extract payload and schema from request</span>
            <span class="s">var payload = requestBody.payload;</span>
            <span class="s">var schema = requestBody.schema;</span>

            <span class="s">// Validate that both payload and schema are present</span>
            <span class="s">if (!payload) {</span>
              <span class="s">context.set('message.status.code', 400);</span>
              <span class="s">context.set('message.body', {</span>
                <span class="s">status: 'error',</span>
                <span class="s">message: 'Missing payload in request body',</span>
                <span class="s">errors: [{</span>
                  <span class="s">field: 'payload',</span>
                  <span class="s">message: 'payload field is required',</span>
                  <span class="s">value: 'undefined'</span>
                <span class="s">}]</span>
              <span class="s">});</span>
              <span class="s">return;</span>
            <span class="s">}</span>

            <span class="s">if (!schema) {</span>
              <span class="s">context.set('message.status.code', 400);</span>
              <span class="s">context.set('message.body', {</span>
                <span class="s">status: 'error',</span>
                <span class="s">message: 'Missing schema in request body',</span>
                <span class="s">errors: [{</span>
                  <span class="s">field: 'schema',</span>
                  <span class="s">message: 'schema field is required',</span>
                  <span class="s">value: 'undefined'</span>
                <span class="s">}]</span>
              <span class="s">});</span>
              <span class="s">return;</span>
            <span class="s">}</span>

            <span class="s">// Validation function</span>
            <span class="s">function validateSchema(data, schema, path) {</span>
              <span class="s">var errors = [];</span>
              <span class="s">path = path || '';</span>

              <span class="s">// Check required fields</span>
              <span class="s">if (schema.required) {</span>
                <span class="s">for (var i = 0; i &lt; schema.required.length; i++) {</span>
                  <span class="s">var requiredField = schema.required[i];</span>
                  <span class="s">if (data[requiredField] === undefined || data[requiredField] === null) {</span>
                    <span class="s">errors.push({</span>
                      <span class="s">field: path + requiredField,</span>
                      <span class="s">message: 'Required field is missing',</span>
                      <span class="s">value: 'undefined'</span>
                    <span class="s">});</span>
                  <span class="s">}</span>
                <span class="s">}</span>
              <span class="s">}</span>

              <span class="s">// Check properties</span>
              <span class="s">if (schema.properties) {</span>
                <span class="s">for (var prop in data) {</span>
                  <span class="s">if (data.hasOwnProperty(prop)) {</span>
                    <span class="s">var propSchema = schema.properties[prop];</span>
                    <span class="s">var value = data[prop];</span>
                    <span class="s">var fieldPath = path + prop;</span>

                    <span class="s">if (!propSchema &amp;&amp; schema.additionalProperties === false) {</span>
                      <span class="s">errors.push({</span>
                        <span class="s">field: fieldPath,</span>
                        <span class="s">message: 'Additional property not allowed',</span>
                        <span class="s">value: String(value)</span>
                      <span class="s">});</span>
                      <span class="s">continue;</span>
                    <span class="s">}</span>

                    <span class="s">if (propSchema) {</span>
                      <span class="s">// Type validation</span>
                      <span class="s">var actualType = Array.isArray(value) ? 'array' : typeof value;</span>
                      <span class="s">if (actualType === 'object' &amp;&amp; value === null) {</span>
                        <span class="s">actualType = 'null';</span>
                      <span class="s">}</span>
            <span class="no">          </span>
                      <span class="s">if (propSchema.type &amp;&amp; actualType !== propSchema.type) {</span>
                        <span class="s">errors.push({</span>
                          <span class="s">field: fieldPath,</span>
                          <span class="s">message: 'Invalid type. Expected ' + propSchema.type + ' but got ' + actualType,</span>
                          <span class="s">value: String(value)</span>
                        <span class="s">});</span>
                        <span class="s">continue;</span>
                      <span class="s">}</span>

                      <span class="s">// String validations</span>
                      <span class="s">if (propSchema.type === 'string' &amp;&amp; typeof value === 'string') {</span>
                        <span class="s">if (propSchema.minLength &amp;&amp; value.length &lt; propSchema.minLength) {</span>
                          <span class="s">errors.push({</span>
                            <span class="s">field: fieldPath,</span>
                            <span class="s">message: 'String length must be at least ' + propSchema.minLength + ' characters',</span>
                            <span class="s">value: value</span>
                          <span class="s">});</span>
                        <span class="s">}</span>
                        <span class="s">if (propSchema.maxLength &amp;&amp; value.length &gt; propSchema.maxLength) {</span>
                          <span class="s">errors.push({</span>
                            <span class="s">field: fieldPath,</span>
                            <span class="s">message: 'String length must not exceed ' + propSchema.maxLength + ' characters',</span>
                            <span class="s">value: value</span>
                          <span class="s">});</span>
                        <span class="s">}</span>
                        <span class="s">if (propSchema.pattern) {</span>
                          <span class="s">var regex = new RegExp(propSchema.pattern);</span>
                          <span class="s">if (!regex.test(value)) {</span>
                            <span class="s">errors.push({</span>
                              <span class="s">field: fieldPath,</span>
                              <span class="s">message: 'String does not match required pattern',</span>
                              <span class="s">value: value</span>
                            <span class="s">});</span>
                          <span class="s">}</span>
                        <span class="s">}</span>
                      <span class="s">}</span>

                      <span class="s">// Number/Integer validations</span>
                      <span class="s">if ((propSchema.type === 'number' || propSchema.type === 'integer') &amp;&amp; typeof value === 'number') {</span>
                        <span class="s">if (propSchema.minimum !== undefined &amp;&amp; value &lt; propSchema.minimum) {</span>
                          <span class="s">errors.push({</span>
                            <span class="s">field: fieldPath,</span>
                            <span class="s">message: 'Value must be at least ' + propSchema.minimum,</span>
                            <span class="s">value: String(value)</span>
                          <span class="s">});</span>
                        <span class="s">}</span>
                        <span class="s">if (propSchema.maximum !== undefined &amp;&amp; value &gt; propSchema.maximum) {</span>
                          <span class="s">errors.push({</span>
                            <span class="s">field: fieldPath,</span>
                            <span class="s">message: 'Value must not exceed ' + propSchema.maximum,</span>
                            <span class="s">value: String(value)</span>
                          <span class="s">});</span>
                        <span class="s">}</span>
                      <span class="s">}</span>
                    <span class="s">}</span>
                  <span class="s">}</span>
                <span class="s">}</span>
              <span class="s">}</span>

              <span class="s">return errors;</span>
            <span class="s">}</span>

            <span class="s">// Perform validation using the provided schema</span>
            <span class="s">var validationErrors = validateSchema(payload, schema, '');</span>

            <span class="s">// Set response based on validation results</span>
            <span class="s">if (validationErrors.length &gt; 0) {</span>
              <span class="s">context.set('message.status.code', 400);</span>
              <span class="s">context.set('message.body', {</span>
                <span class="s">status: 'error',</span>
                <span class="s">message: 'Validation failed',</span>
                <span class="s">errors: validationErrors</span>
              <span class="s">});</span>
            <span class="s">} else {</span>
              <span class="s">context.set('message.status.code', 200);</span>
              <span class="s">context.set('message.body', {</span>
                <span class="s">status: 'success',</span>
                <span class="s">message: 'Validation passed',</span>
                <span class="s">data: payload</span>
              <span class="s">});</span>
            <span class="s">}</span>
  <span class="na">activity-log</span><span class="pi">:</span>
    <span class="na">enabled</span><span class="pi">:</span> <span class="no">true</span>
    <span class="na">success-content</span><span class="pi">:</span> <span class="s">activity</span>
    <span class="na">error-content</span><span class="pi">:</span> <span class="s">payload</span>
</code></pre></div></div>

<h2 id="understanding-the-implementation">Understanding the Implementation</h2>

<h3 id="1-request-structure">1. Request Structure</h3>

<p>This API uses a flexible approach where both the payload and schema are sent in the request body:</p>

<p><strong>Request Body Structure</strong> (<code class="language-plaintext highlighter-rouge">ValidationRequest</code>):</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"payload"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="err">//</span><span class="w"> </span><span class="err">The</span><span class="w"> </span><span class="err">data</span><span class="w"> </span><span class="err">to</span><span class="w"> </span><span class="err">be</span><span class="w"> </span><span class="err">validated</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"schema"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="err">//</span><span class="w"> </span><span class="err">JSON</span><span class="w"> </span><span class="err">Schema</span><span class="w"> </span><span class="err">definition</span><span class="w">
    </span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"object"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"required"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"field1"</span><span class="p">,</span><span class="w"> </span><span class="s2">"field2"</span><span class="p">],</span><span class="w">
    </span><span class="nl">"properties"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="err">//</span><span class="w"> </span><span class="err">Property</span><span class="w"> </span><span class="err">definitions</span><span class="w">
    </span><span class="p">}</span><span class="w">
  </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p><strong>Key Benefits</strong>:</p>
<ul>
  <li><strong>Dynamic validation</strong>: No need to redeploy the API for different schemas</li>
  <li><strong>Reusable service</strong>: One API can validate any payload against any schema</li>
  <li><strong>Flexible</strong>: Supports different validation requirements without code changes</li>
  <li><strong>Testable</strong>: Easy to test different schemas and payloads</li>
</ul>

<h2 id="example-requests-and-responses">Example Requests and Responses</h2>

<h3 id="valid-request">Valid Request</h3>

<p><strong>Request</strong>:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-X</span> POST https://api.example.com/validate/user <span class="se">\</span>
  <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span>
  <span class="nt">-d</span> <span class="s1">'{
    "payload": {
      "name": "John Doe",
      "email": "john.doe@example.com",
      "age": 30
    },
    "schema": {
      "type": "object",
      "required": ["name", "email", "age"],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 2,
          "maxLength": 50,
          "pattern": "^[a-zA-Z\\s]+$"
        },
        "email": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
        },
        "age": {
          "type": "number",
          "minimum": 18,
          "maximum": 120
        }
      },
      "additionalProperties": false
    }
  }'</span>
</code></pre></div></div>

<p><strong>Response</strong> (200 OK):</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"success"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Validation passed"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"data"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"John Doe"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"john.doe@example.com"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"age"</span><span class="p">:</span><span class="w"> </span><span class="mi">30</span><span class="w">
  </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h3 id="invalid-request---missing-required-field">Invalid Request - Missing Required Field</h3>

<p><strong>Request</strong>:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-X</span> POST https://api.example.com/validate/user <span class="se">\</span>
  <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span>
  <span class="nt">-d</span> <span class="s1">'{
    "payload": {
      "name": "John Doe",
      "email": "john.doe@example.com"
    },
    "schema": {
      "type": "object",
      "required": ["name", "email", "age"],
      "properties": {
        "name": {"type": "string"},
        "email": {"type": "string"},
        "age": {"type": "number"}
      }
    }
  }'</span>
</code></pre></div></div>

<p><strong>Response</strong> (400 Bad Request):</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"error"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Validation failed"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"errors"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"field"</span><span class="p">:</span><span class="w"> </span><span class="s2">"age"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Required field is missing"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"undefined"</span><span class="w">
    </span><span class="p">}</span><span class="w">
  </span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h3 id="invalid-request---multiple-validation-errors">Invalid Request - Multiple Validation Errors</h3>

<p><strong>Request</strong>:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-X</span> POST https://api.example.com/validate/user <span class="se">\</span>
  <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span>
  <span class="nt">-d</span> <span class="s1">'{
    "payload": {
      "name": "J",
      "email": "invalid-email",
      "age": 15,
      "extraField": "not allowed"
    },
    "schema": {
      "type": "object",
      "required": ["name", "email", "age"],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 2
        },
        "email": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
        },
        "age": {
          "type": "number",
          "minimum": 18
        }
      },
      "additionalProperties": false
    }
  }'</span>
</code></pre></div></div>

<p><strong>Response</strong> (400 Bad Request):</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"error"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Validation failed"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"errors"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"field"</span><span class="p">:</span><span class="w"> </span><span class="s2">"name"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"String length must be at least 2 characters"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"J"</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"field"</span><span class="p">:</span><span class="w"> </span><span class="s2">"email"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"String does not match required pattern"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"invalid-email"</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"field"</span><span class="p">:</span><span class="w"> </span><span class="s2">"age"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Value must be at least 18"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"15"</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"field"</span><span class="p">:</span><span class="w"> </span><span class="s2">"extraField"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Additional property not allowed"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"not allowed"</span><span class="w">
    </span><span class="p">}</span><span class="w">
  </span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h3 id="invalid-request---wrong-data-type">Invalid Request - Wrong Data Type</h3>

<p><strong>Request</strong>:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-X</span> POST https://api.example.com/validate/user <span class="se">\</span>
  <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span>
  <span class="nt">-d</span> <span class="s1">'{
    "payload": {
      "name": "John Doe",
      "email": "john.doe@example.com",
      "age": "thirty"
    },
    "schema": {
      "type": "object",
      "required": ["name", "email", "age"],
      "properties": {
        "name": {"type": "string"},
        "email": {"type": "string"},
        "age": {"type": "number"}
      }
    }
  }'</span>
</code></pre></div></div>

<p><strong>Response</strong> (400 Bad Request):</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"error"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Validation failed"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"errors"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"field"</span><span class="p">:</span><span class="w"> </span><span class="s2">"age"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Invalid type. Expected number but got string"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"thirty"</span><span class="w">
    </span><span class="p">}</span><span class="w">
  </span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h2 id="additional-resources">Additional Resources</h2>

<ul>
  <li><a href="https://www.ibm.com/docs/en/api-connect/10.0.x?topic=constructs-gatewayscript-api">IBM API Connect GatewayScript Documentation</a></li>
  <li><a href="https://json-schema.org/">JSON Schema Specification</a></li>
  <li><a href="https://www.ibm.com/docs/en/datapower-gateway">DataPower GatewayScript Reference</a></li>
</ul>]]></content><author><name>[&quot;ChrisPhillips&quot;, &quot;SimonKapadia&quot;]</name></author><category term="APIConnect" /><summary type="html"><![CDATA[When building APIs, robust input validation is critical for security, data integrity, and providing clear error messages to API consumers. While API Connect provides built-in validation through OpenAPI schemas, sometimes you need to explan why the validation failed to the consumers. This article demonstrates how to implement custom request body validation using GatewayScript that validates against a JSON schema and returns detailed error messages for each invalid field.]]></summary></entry><entry><title type="html">Monitoring GatewayScript Availability with DataPower REST API: Real-Time Performance Tracking</title><link href="https://chrisphillips-cminion.github.io/apiconnect/2026/03/03/monitoring-gatewayscript-availability-rest-api.html" rel="alternate" type="text/html" title="Monitoring GatewayScript Availability with DataPower REST API: Real-Time Performance Tracking" /><published>2026-03-03T01:00:00+00:00</published><updated>2026-03-03T01:00:00+00:00</updated><id>https://chrisphillips-cminion.github.io/apiconnect/2026/03/03/monitoring-gatewayscript-availability-rest-api</id><content type="html" xml:base="https://chrisphillips-cminion.github.io/apiconnect/2026/03/03/monitoring-gatewayscript-availability-rest-api.html"><![CDATA[<p>In our <a href="/apiconnect/2026/02/04/apigw-gatewayscript-concurrency.html">previous article on GatewayScript concurrency</a>, we explored how to understand and optimize GatewayScript engine performance. But how do you monitor these engines in real-time without constantly logging into the DataPower CLI?</p>

<p>The answer: DataPower’s REST Management Interface. This powerful API allows you to programmatically query GatewayScript status and build automated monitoring solutions.</p>

<!--more-->

<h2 id="why-monitor-gatewayscript-availability">Why Monitor GatewayScript Availability?</h2>

<p>As we discussed in our <a href="/apiconnect/2026/02/04/apigw-gatewayscript-concurrency.html">GatewayScript bottlenecks guide</a>, understanding engine availability is critical for:</p>

<ul>
  <li><strong>Detecting bottlenecks</strong> before they impact users</li>
  <li><strong>Capacity planning</strong> based on actual usage patterns</li>
  <li><strong>Performance trending</strong> over time</li>
  <li><strong>Alerting</strong> when engines are saturated</li>
  <li><strong>Troubleshooting</strong> performance issues in production</li>
</ul>

<p>The CLI command <code class="language-plaintext highlighter-rouge">show gatewayscript-status</code> is great for ad-hoc checks, but for continuous monitoring, you need automation.</p>

<h2 id="the-datapower-rest-management-interface">The DataPower REST Management Interface</h2>

<p>DataPower provides a comprehensive REST API for management operations. The endpoint we’re interested in is:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>GET https://&lt;datapower-host&gt;:5554/mgmt/status/&lt;domain&gt;/GatewayScriptStatus
</code></pre></div></div>

<p>This endpoint returns the same information as the CLI <code class="language-plaintext highlighter-rouge">show gatewayscript-status</code> command, but in JSON format that’s perfect for automation.</p>

<h2 id="quick-start-monitoring-script">Quick Start: Monitoring Script</h2>

<p>Here’s a simple bash one-liner to continuously monitor GatewayScript availability:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">while </span><span class="nb">true</span><span class="p">;</span> <span class="k">do 
  </span>curl <span class="nt">-k</span> <span class="nt">-u</span> admin:password <span class="nt">-X</span> GET <span class="se">\</span>
    https://1.2.3.4:5554/mgmt/status/default/GatewayScriptStatus 2&gt;&amp;1 | <span class="se">\</span>
    <span class="nb">grep </span>Available<span class="p">;</span> 
  <span class="nb">echo</span><span class="p">;</span> 
<span class="k">done</span>
</code></pre></div></div>

<p><strong>What This Does:</strong></p>
<ul>
  <li>Continuously polls the GatewayScript status endpoint</li>
  <li>Extracts the “Available” field showing engine availability</li>
  <li>Displays results in real-time</li>
  <li>Runs indefinitely until stopped (Ctrl+C)</li>
</ul>

<p><strong>Sample Output:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    "Available": 8,
    "Available": 8,
    "Available": 8,
    "Available": 8, 
</code></pre></div></div>

<h2 id="understanding-the-response">Understanding the Response</h2>

<p>The full JSON response from the REST API endpoint contains valuable metrics. Here’s the actual output structure:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>curl <span class="nt">-k</span> <span class="nt">-u</span> admin:password <span class="nt">-X</span> GET https://1.2.3.4:5554/mgmt/status/default/GatewayScriptStatus
<span class="o">{</span>
  <span class="s2">"_links"</span>: <span class="o">{</span>
    <span class="s2">"self"</span>: <span class="o">{</span>
      <span class="s2">"href"</span>: <span class="s2">"/mgmt/status/default/GatewayScriptStatus"</span>
    <span class="o">}</span>,
    <span class="s2">"doc"</span>: <span class="o">{</span>
      <span class="s2">"href"</span>: <span class="s2">"/mgmt/docs/status/GatewayScriptStatus"</span>
    <span class="o">}</span>
  <span class="o">}</span>,
  <span class="s2">"GatewayScriptStatus"</span>: <span class="o">{</span>
    <span class="s2">"Available"</span>: 8,
    <span class="s2">"InUse"</span>: 0,
    <span class="s2">"QueuedWork"</span>: 0,
    <span class="s2">"Failed"</span>: 0
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p><strong>Note:</strong> The values are returned as integers (not strings), making them easy to parse and compare in monitoring scripts.</p>

<p><strong>Key Fields:</strong></p>

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Description</th>
      <th>What to Monitor</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-plaintext highlighter-rouge">Available</code></td>
      <td>Total engines configured (integer)</td>
      <td>Should match CPU core count unless on a physical appliance</td>
    </tr>
    <tr>
      <td><code class="language-plaintext highlighter-rouge">InUse</code></td>
      <td>Engines currently executing (integer)</td>
      <td>Watch for approaching Available count</td>
    </tr>
    <tr>
      <td><code class="language-plaintext highlighter-rouge">QueuedWork</code></td>
      <td>Requests waiting for engines (integer)</td>
      <td><strong>RED FLAG if &gt; 0</strong></td>
    </tr>
    <tr>
      <td><code class="language-plaintext highlighter-rouge">Failed</code></td>
      <td>GatewayScript execution errors (integer)</td>
      <td>Should always be 0</td>
    </tr>
  </tbody>
</table>

<h2 id="enhanced-monitoring-script">Enhanced Monitoring Script</h2>

<p>For production monitoring, you’ll want more detail. Here’s an enhanced version:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>

<span class="c"># Configuration</span>
<span class="nv">DATAPOWER_HOST</span><span class="o">=</span><span class="s2">"9.37.230.250"</span>
<span class="nv">DATAPOWER_PORT</span><span class="o">=</span><span class="s2">"5554"</span>
<span class="nv">DOMAIN</span><span class="o">=</span><span class="s2">"default"</span>
<span class="nv">USERNAME</span><span class="o">=</span><span class="s2">"admin"</span>
<span class="nv">PASSWORD</span><span class="o">=</span><span class="s2">"Level2was"</span>
<span class="nv">POLL_INTERVAL</span><span class="o">=</span>5  <span class="c"># seconds</span>

<span class="c"># Colors for output</span>
<span class="nv">RED</span><span class="o">=</span><span class="s1">'\033[0;31m'</span>
<span class="nv">YELLOW</span><span class="o">=</span><span class="s1">'\033[1;33m'</span>
<span class="nv">GREEN</span><span class="o">=</span><span class="s1">'\033[0;32m'</span>
<span class="nv">NC</span><span class="o">=</span><span class="s1">'\033[0m'</span> <span class="c"># No Color</span>

<span class="nb">echo</span> <span class="s2">"Monitoring GatewayScript Status on </span><span class="k">${</span><span class="nv">DATAPOWER_HOST</span><span class="k">}</span><span class="s2">:</span><span class="k">${</span><span class="nv">DATAPOWER_PORT</span><span class="k">}</span><span class="s2">"</span>
<span class="nb">echo</span> <span class="s2">"Domain: </span><span class="k">${</span><span class="nv">DOMAIN</span><span class="k">}</span><span class="s2">"</span>
<span class="nb">echo</span> <span class="s2">"Poll Interval: </span><span class="k">${</span><span class="nv">POLL_INTERVAL</span><span class="k">}</span><span class="s2">s"</span>
<span class="nb">echo</span> <span class="s2">"Press Ctrl+C to stop"</span>
<span class="nb">echo</span> <span class="s2">"----------------------------------------"</span>

<span class="k">while </span><span class="nb">true</span><span class="p">;</span> <span class="k">do</span>
    <span class="c"># Get current timestamp</span>
    <span class="nv">TIMESTAMP</span><span class="o">=</span><span class="si">$(</span><span class="nb">date</span> <span class="s1">'+%Y-%m-%d %H:%M:%S'</span><span class="si">)</span>
    
    <span class="c"># Query the REST API</span>
    <span class="nv">RESPONSE</span><span class="o">=</span><span class="si">$(</span>curl <span class="nt">-k</span> <span class="nt">-s</span> <span class="nt">-u</span> <span class="k">${</span><span class="nv">USERNAME</span><span class="k">}</span>:<span class="k">${</span><span class="nv">PASSWORD</span><span class="k">}</span> <span class="se">\</span>
        <span class="nt">-X</span> GET <span class="se">\</span>
        <span class="s2">"https://</span><span class="k">${</span><span class="nv">DATAPOWER_HOST</span><span class="k">}</span><span class="s2">:</span><span class="k">${</span><span class="nv">DATAPOWER_PORT</span><span class="k">}</span><span class="s2">/mgmt/status/</span><span class="k">${</span><span class="nv">DOMAIN</span><span class="k">}</span><span class="s2">/GatewayScriptStatus"</span><span class="si">)</span>
    
    <span class="c"># Extract values using grep and sed (values are integers, not strings)</span>
    <span class="nv">AVAILABLE</span><span class="o">=</span><span class="si">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$RESPONSE</span><span class="s2">"</span> | <span class="nb">grep</span> <span class="nt">-o</span> <span class="s1">'"Available" : [0-9]*'</span> | <span class="nb">sed</span> <span class="s1">'s/"Available" : //'</span><span class="si">)</span>
    <span class="nv">INUSE</span><span class="o">=</span><span class="si">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$RESPONSE</span><span class="s2">"</span> | <span class="nb">grep</span> <span class="nt">-o</span> <span class="s1">'"InUse" : [0-9]*'</span> | <span class="nb">sed</span> <span class="s1">'s/"InUse" : //'</span><span class="si">)</span>
    <span class="nv">QUEUED</span><span class="o">=</span><span class="si">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$RESPONSE</span><span class="s2">"</span> | <span class="nb">grep</span> <span class="nt">-o</span> <span class="s1">'"QueuedWork" : [0-9]*'</span> | <span class="nb">sed</span> <span class="s1">'s/"QueuedWork" : //'</span><span class="si">)</span>
    <span class="nv">FAILURES</span><span class="o">=</span><span class="si">$(</span><span class="nb">echo</span> <span class="s2">"</span><span class="nv">$RESPONSE</span><span class="s2">"</span> | <span class="nb">grep</span> <span class="nt">-o</span> <span class="s1">'"Failed" : [0-9]*'</span> | <span class="nb">sed</span> <span class="s1">'s/"Failed" : //'</span><span class="si">)</span>
    

    <span class="c"># Calculate utilization percentage</span>
    <span class="k">if</span> <span class="o">[</span> <span class="nt">-n</span> <span class="s2">"</span><span class="nv">$AVAILABLE</span><span class="s2">"</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$AVAILABLE</span><span class="s2">"</span> <span class="nt">-gt</span> 0 <span class="o">]</span><span class="p">;</span> <span class="k">then
        </span><span class="nv">UTILIZATION</span><span class="o">=</span><span class="k">$((</span>INUSE <span class="o">*</span> <span class="m">100</span> <span class="o">/</span> AVAILABLE<span class="k">))</span>
    <span class="k">else
        </span><span class="nv">UTILIZATION</span><span class="o">=</span>0
    <span class="k">fi</span>
    
    <span class="c"># Determine status color</span>
    <span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$QUEUED</span><span class="s2">"</span> <span class="nt">-gt</span> 0 <span class="o">]</span><span class="p">;</span> <span class="k">then
        </span><span class="nv">STATUS_COLOR</span><span class="o">=</span><span class="nv">$RED</span>
        <span class="nv">STATUS</span><span class="o">=</span><span class="s2">"CRITICAL"</span>
    <span class="k">elif</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$UTILIZATION</span><span class="s2">"</span> <span class="nt">-ge</span> 80 <span class="o">]</span><span class="p">;</span> <span class="k">then
        </span><span class="nv">STATUS_COLOR</span><span class="o">=</span><span class="nv">$YELLOW</span>
        <span class="nv">STATUS</span><span class="o">=</span><span class="s2">"WARNING"</span>
    <span class="k">else
        </span><span class="nv">STATUS_COLOR</span><span class="o">=</span><span class="nv">$GREEN</span>
        <span class="nv">STATUS</span><span class="o">=</span><span class="s2">"OK"</span>
    <span class="k">fi</span>
    
    <span class="c"># Display status</span>
    <span class="nb">echo</span> <span class="nt">-e</span> <span class="s2">"</span><span class="k">${</span><span class="nv">TIMESTAMP</span><span class="k">}</span><span class="s2"> | </span><span class="k">${</span><span class="nv">STATUS_COLOR</span><span class="k">}${</span><span class="nv">STATUS</span><span class="k">}${</span><span class="nv">NC</span><span class="k">}</span><span class="s2"> | Available: </span><span class="k">${</span><span class="nv">AVAILABLE</span><span class="k">}</span><span class="s2"> | In-Use: </span><span class="k">${</span><span class="nv">INUSE</span><span class="k">}</span><span class="s2"> (</span><span class="k">${</span><span class="nv">UTILIZATION</span><span class="k">}</span><span class="s2">%) | Queued: </span><span class="k">${</span><span class="nv">QUEUED</span><span class="k">}</span><span class="s2"> | Failures: </span><span class="k">${</span><span class="nv">FAILURES</span><span class="k">}</span><span class="s2">"</span>
    
    <span class="c"># Alert on critical conditions</span>
    <span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$QUEUED</span><span class="s2">"</span> <span class="nt">-gt</span> 0 <span class="o">]</span><span class="p">;</span> <span class="k">then
        </span><span class="nb">echo</span> <span class="nt">-e</span> <span class="s2">"</span><span class="k">${</span><span class="nv">RED</span><span class="k">}</span><span class="s2">⚠️  ALERT: </span><span class="k">${</span><span class="nv">QUEUED</span><span class="k">}</span><span class="s2"> requests queued - engines saturated!</span><span class="k">${</span><span class="nv">NC</span><span class="k">}</span><span class="s2">"</span>
    <span class="k">fi
    
    if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$FAILURES</span><span class="s2">"</span> <span class="nt">-gt</span> 0 <span class="o">]</span><span class="p">;</span> <span class="k">then
        </span><span class="nb">echo</span> <span class="nt">-e</span> <span class="s2">"</span><span class="k">${</span><span class="nv">RED</span><span class="k">}</span><span class="s2">⚠️  ALERT: </span><span class="k">${</span><span class="nv">FAILURES</span><span class="k">}</span><span class="s2"> GatewayScript failures detected!</span><span class="k">${</span><span class="nv">NC</span><span class="k">}</span><span class="s2">"</span>
    <span class="k">fi
    
    </span><span class="nb">sleep</span> <span class="nv">$POLL_INTERVAL</span>
<span class="k">done</span>
</code></pre></div></div>

<p><strong>Sample Output:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Monitoring GatewayScript Status on 1.2.3.4:5554
Domain: default
Poll Interval: 5s
Press Ctrl+C to stop
----------------------------------------
2026-03-03 14:30:00 | OK | Available: 8 | In-Use: 2 (25%) | Queued: 0 | Failures: 0
2026-03-03 14:30:05 | OK | Available: 8 | In-Use: 3 (37%) | Queued: 0 | Failures: 0
2026-03-03 14:30:10 | WARNING | Available: 8 | In-Use: 7 (87%) | Queued: 0 | Failures: 0
2026-03-03 14:30:15 | CRITICAL | Available: 8 | In-Use: 8 (100%) | Queued: 5 | Failures: 0
⚠️  ALERT: 5 requests queued - engines saturated!
</code></pre></div></div>

<h2 id="troubleshooting">Troubleshooting</h2>

<h3 id="connection-refused">Connection Refused</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl: <span class="o">(</span>7<span class="o">)</span> Failed to connect to 1.2.3.4 port 5554: Connection refused
</code></pre></div></div>

<p><strong>Solutions:</strong></p>
<ul>
  <li>Verify REST Management Interface is enabled</li>
  <li>Check firewall rules</li>
  <li>Confirm port 5554 is correct (default for REST interface)</li>
</ul>

<h3 id="authentication-failed">Authentication Failed</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl: <span class="o">(</span>22<span class="o">)</span> The requested URL returned error: 401 Unauthorized
</code></pre></div></div>

<p><strong>Solutions:</strong></p>
<ul>
  <li>Verify username and password</li>
  <li>Check user has appropriate permissions</li>
  <li>Ensure user is not locked out</li>
</ul>

<h3 id="empty-response">Empty Response</h3>

<p><strong>Solutions:</strong></p>
<ul>
  <li>Verify domain name is correct</li>
  <li>Check GatewayScript is enabled in the domain</li>
  <li>Confirm API Gateway service is running</li>
</ul>

<h2 id="conclusion">Conclusion</h2>

<p>Monitoring GatewayScript availability through the DataPower REST API provides:</p>

<ul>
  <li><strong>Real-time visibility</strong> into engine utilization</li>
  <li><strong>Automated alerting</strong> for capacity issues</li>
  <li><strong>Historical data</strong> for trend analysis</li>
  <li><strong>Integration</strong> with enterprise monitoring tools</li>
</ul>

<p>Combined with the capacity planning formulas from our <a href="/apiconnect/2026/02/04/apigw-gatewayscript-concurrency.html">previous article</a>, you now have a complete toolkit for managing GatewayScript performance in production environments.</p>

<h2 id="additional-resources">Additional Resources</h2>

<ul>
  <li><a href="https://www.ibm.com/docs/en/datapower-gateway">DataPower REST Management Interface Documentation</a></li>
  <li><a href="/apiconnect/2026/02/04/apigw-gatewayscript-concurrency.html">GatewayScript Concurrency Guide</a></li>
</ul>

<hr />]]></content><author><name>[&quot;ChrisPhillips&quot;, &quot;TreyWilliamson&quot;]</name></author><category term="APIConnect" /><category term="APIConnect" /><category term="DataPower" /><category term="GatewayScript" /><category term="Monitoring" /><category term="REST API" /><category term="Performance" /><summary type="html"><![CDATA[Learn how to use the DataPower REST Management Interface to continuously monitor GatewayScript engine availability and detect performance bottlenecks in real-time.]]></summary></entry></feed>