title: aws cli logs filter-pattern exclude
body: <p>I'm trying to get logs from an application running in AWS, while excluding logs that contain a certain phrase:</p>
  
  <pre><code>aws logs filter-log-events --log-group-name $MY_LOG_GROUP --filter-pattern -"dont want"
  </code></pre>
  
  <p>The above works. However, if I instead try:</p>
  
  <pre><code>aws logs filter-log-events --log-group-name $MY_LOG_GROUP --filter-pattern -"dontwant"
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>aws: error: argument --filter-pattern: expected one argument
  </code></pre>
  
  <p>I assume my shell is parsing it as an additional flag, instead of an argument to <code>--filter-pattern</code>. So, first question: How do I force aws cli to treat it as an argument?</p>
  
  <p>If I instead try:</p>
  
  <pre><code>aws logs filter-log-events --log-group-name "$MY_LOG_GROUP" --filter-pattern -"GET /healthcheck"
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>An error occurred (InvalidParameterException) when calling the FilterLogEvents operation: Invalid filter pattern
  </code></pre>
  
  <p>Second question(s): what's the issue here, and how do I fix it?</p>