title: AWS Cloudwatch Log Insights - replace string function
body: <p>How do I use AWS Cloudwatch Log Insights' <strong>replace</strong> function?</p>
  <p>The <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html" rel="nofollow noreferrer">docs</a> do not give working examples.</p>
  <p>Given logs which contain paths such as <code>/api/lumberjack/123/axe/456/fashion</code></p>
  <p>I am trying:</p>
  <pre><code>fields message
  | parse message &quot;path=* &quot; as path
  | fields replace(path, /[0123456789]+/, 'ID') as uniqpath
  | stats count(*) by uniqpath
  </code></pre>
  <p>I expect results like:</p>
  <pre><code>uniqpath | count
  /api/lumberjack/ID/axe/ID/fashion | 12
  /api/lumberjack/ID/beardedness | 44
  </code></pre>
  <p>But instead it complains &quot;Invalid arguments, received: (path) but expected: (str: string,searchValue: string,replaceValue: string)&quot;</p>