How to output pretty json to stdout


#1

I can't seem to find out how to output my log as pretty json to stdout. The default rubydebug output in my opinion is excruciating to look at. For example, I want the following log to look like this when printed to stdout:

{
  "@timestamp": "2018-10-07T05:14:10.879Z",
  "@version": "1",
  "alpha": {
    "bravo": 1,
    "charlie": {
      "delta": 2,
      "echo": 3
    },
    "foxtrot": 4
  }
}

Instead I get this absolute trash

{
         "@timestamp" => 2018-10-07T05:14:10.879Z,
           "@version" => "1",
              "alpha" => {
                            "bravo" => 1,
                          "charlie" => {
                "delta" => 2,
                 "echo" => 3
        },
                          "foxtrot" => 4
    }
}

This is driving me bananas. I tried the following

output {
  stdout { codec => json }
}

and it just prints

{"@timestamp":"2018-10-07T05:14:10.879Z","@version":"1","alpha":{"bravo":1,"charlie":{"delta":2,"echo":3},"foxtrot":4}}

If json is not available, id be fine with any format that is ALIGNED in a NORMAL alignment.


(Magnus B├Ąck) #2

I don't believe this is supported.


#3

ok thanks for your response!


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.