title: How to split Cloudwatch field by its value in insights query
body: <p>I'm trying to create an AWS dashboard visualization that displays the counts of cache hits vs. misses over a period of time. To do this, I'm setting up a <code>log</code> type dashboard with an insights query on the log. To be as simple as possible, my log is either:</p>
  <p><code>{&quot;cache.hit&quot;, true}</code> or <code>{&quot;cache.hit&quot;, false}</code>.</p>
  <p>I would like for my dashboard to track both possibilities on the same graph, but it seems like I can't without breaking my log up into distinct rows for these values. For example, if my logs were simply:</p>
  <p><code>{&quot;cache.hit.true&quot;, true}</code> or <code>{&quot;cache.hit.false&quot;, true}</code>, then I could create 2 separate graphs to track these values independently in the dashboard, but that's not as clean.</p>
  <p>To get them on one dash, I've tried this, but all it does is display the two fields, and the values for both display fields are the same, when they definitely shouldn't be:</p>
  <pre><code>fields @timestamp, @message, cache.hit as cache_hits
  | filter cache_hits IN [0, 1]
  | display cache_hits = 0 as in_cache_false
  | display cache_hits = 1 as in_cache_true
  | stat count (in_cache_true), count(in_cache_false) by bin(30s)
  | sort @timestamp desc
  | limit 20
  </code></pre>