title: AWS Cloudwatch Log Insights - Filter Records by JSON filters on JSON log events
body: <p>I have a log group which accumulates JSON logs to each of its streams. These JSON logs look like this.</p>
  
  <p><a href="https://i.stack.imgur.com/iNG4m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iNG4m.png" alt="enter image description here"></a></p>
  
  <p>I want to filter logs where <code>"user" = "keet"</code>. AWS documentation explains on <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html" rel="nofollow noreferrer">Using Metric Filters to Extract Values from JSON Log Events</a>. I tried this using the AWS SDK, and it worked fine for the following code in NodeJS.</p>
  
  <pre><code>let params = {
      logGroupName: 'log-goupe-name', /* required */
      filterPattern: '{$.user=keet}',
  
  };
  cloudwatchlogs.filterLogEvents(params, function(err, data) {
      if (err) console.log(err, err.stack); // an error occurred
      else     console.log(data);           // successful response
  });
  </code></pre>
  
  <p><strong>Question</strong>:</p>
  
  <p>Similarly, I want to know whether the same is possible on AWS Cloudwatch Insights Dashboard, on AWS Console? I know string pattern matching is possible. But I wanna know whether JSON field matching is possible on the Insights dashboard using <code>@filter</code>. The default query that comes is as follows. </p>
  
  <pre><code>fields @timestamp, @message
  | sort @timestamp desc
  | limit 20
  </code></pre>
  
  <p>I tried following this answer on <a href="https://stackoverflow.com/questions/53725133/amazon-cloudwatch-logs-insights-with-json-fields">Stackoverflow</a>, and it still did not help. This is only for parsing data. My requirement is to filter logs based on value in JSON logs.</p>
  
  <p>Thanks in advance.</p>