title: Logstash filter - name fields dynamically
body: <p>I've got log lines in the following format and want to extract fields:</p>
  
  <pre><code>"field1" =&gt; "content1","field2" =&gt; "content2",field3" =&gt; "content3",...
  </code></pre>
  
  <p>I neither know the field names, nor the number of fields.</p>
  
  <p>I tried it with ruby  but got errors: </p>
  
  <blockquote>
    <p>Error: Expected one of #, {, } at line 8, column 51 (byte 113) after filter {
        ruby {
            code => "
                fieldArray = event['message'].split('"</p>
  </blockquote>
  
  <p>my conf are as follows,</p>
  
  <pre><code>input {
      stdin {}
        }
  
  filter {
  ruby {
      code =&gt; "
          fieldArray = event['message'].split('", "')
          for field in fieldArray
              field = field.delete '",'
              field = field.delete '"'
              result = field.split(': ')
              event[result[0]] = result[1]
          end
      "
    }
  }
  
  output {
      stdout {
          codec =&gt; rubydebug
        }
   }
  </code></pre>
  
  <p>please tell me how to fix these errors? </p>
  
  <p>Thanks for your help.</p>