title: AWS log Insigts parse NGINX log
body: <p>I am trying to use aws log insights to run query on my log group that contains nginx log.</p>
  <p>This is my log format that I have setup on my ec2 machine:</p>
  <pre><code>log_format main '$remote_addr - $remote_user [$time_local] &quot;$request&quot; '
  '$status $body_bytes_sent &quot;$http_referer&quot; '
  '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';
  </code></pre>
  <p>Sample NGINX Log:</p>
  <pre><code>xx.xx.xx.xx - - [10/Nov/2020:15:28:30 +0530] &quot;POST /xx HTTP/1.1&quot; 200 57 &quot;https://xxxx.in/&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36&quot; &quot;-&quot;
  </code></pre>
  <p>I am trying to parse this using log insights with the following code:</p>
  <pre><code>parse @message '* - - [*] &quot;* * *&quot; * * &quot;-&quot; &quot;*&quot;' as remote_addr, timestamp, request_type, location, protocol, response_code, body_bytes_sent
  </code></pre>
  <p>I am getting the following error:</p>
  <pre><code>Expression is invalid: parse@message'* - - [*] &quot;* * *&quot; * * &quot;-&quot; &quot;*&quot;'asremote_addr,timestamp,request_type,location,protocol,response_code,body_bytes_sent
  </code></pre>
  <p>Any help would be appreiciated</p>