Search code examples
elasticsearchloggingfilebeat

Can filebeat convert log lines output to json without logstash in pipeline?


We have standard log lines in our Spring Boot web applications (non json). We need to centralize our logging and ship them to an elastic search as json.

(I've heard the later versions can do some transformation)

Can Filebeat read the log lines and wrap them as a json ? i guess it could append some meta data aswell. no need to parse the log line.

expected output : {timestamp : "", beat: "", message: "the log line..."}

i have no code to show unfortunately.


Solution

  • Well it seems to do it by default. this is my result when i tried it locally to read log lines. it wraps it exactly like i wanted.

    {  
       "@timestamp":"2019-06-12T11:11:49.094Z",
       "@metadata":{  
          "beat":"filebeat",
          "type":"doc",
          "version":"6.2.4"
       },
       "message":"the log line...",
       "source":"/Users/myusername/tmp/hej.log",
       "offset":721,
       "prospector":{  
          "type":"log"
       },
       "beat":{  
          "name":"my-macbook.local",
          "hostname":"my-macbook.local",
          "version":"6.2.4"
       }
    }