在Terraform中,是否可以将日志作为json获取?

在Terraform中,是否可以将日志作为json获取?,json,terraform,Json,Terraform,我想记录我们组织中的所有地形操作。 例如: ------------------------------------------------------------------------ An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: ~ update in-place Terraform will pe

我想记录我们组织中的所有地形操作。 例如:

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ aws_instance.created_instance_record[0]
      disable_api_termination: "true" => "false"
      tags.V_Recepies:         "role[af-base], recipe[af-elasticsearch-6]n" => ""run_list":["role[af-base]","recipe[af-elasticsearch-6]"]"

  ~ aws_instance.created_instance_record[1]
      disable_api_termination: "true" => "false"
      tags.V_Recepies:         "role[af-base], recipe[af-elasticsearch-6]n" => ""run_list":["role[af-base]","recipe[af-elasticsearch-6]"]"

  ~ aws_instance.created_instance_record[2]
      disable_api_termination: "true" => "false"
      tags.V_Recepies:         "role[af-base], recipe[af-elasticsearch-6]n" => ""run_list":["role[af-base]","recipe[af-elasticsearch-6]"]"


Plan: 0 to add, 3 to change, 0 to destroy.

------------------------------------------------------------------------
现在,我们在shell脚本中收集输出并将其推到slack。我想收集这些信息并发送给ELK,但为了使其有意义,我需要json输出,或类似的输出,如下所示:

{
    [ 
        { 
            object: aws_instance, 
            disable_api_termination: "true" => "false", 
            tags: 
                [V_Recepies: "role[af-base], recipe[af-elasticsearch-6]n" => ""run_list":["role[af-base]","recipe[af-elasticsearch-6]"]"]

        },
        { 
            object: aws_instance, 
            disable_api_termination: "true" => "false", 
            tags: 
                [V_Recepies: "role[af-base], recipe[af-elasticsearch-6]n" => ""run_list":["role[af-base]","recipe[af-elasticsearch-6]"]"]

        },
        { 
            object: aws_instance, 
            disable_api_termination: "true" => "false", 
            tags: 
                [V_Recepies: "role[af-base], recipe[af-elasticsearch-6]n" => ""run_list":["role[af-base]","recipe[af-elasticsearch-6]"]"]

        }
    ]

}
我看到Terraform有json输出,但只用于一些东西。 有没有办法将TF日志转换为json?
谢谢

你能解释一下你想从这里离开地球的感觉吗?在我看来,这并不是一个很好的结构化日志,可以用来进行分析,但也许我错过了你想要做的事情。如果你可以发布你当前得到的输出以及你想要的,那么这将是有用的。编辑原始帖子会有帮助的,如果你可以模拟JSON输出的样子以及它在ElasticSearch中的用处,或者甚至解释为什么你希望保留此输出以供分析。编辑原始姿势这不是在地形上是可行的,我甚至看不到一个简单的方法来改变你想要的东西。你可以尝试提出一个功能要求,但我不确定是否会有很多兴趣在这方面的工作,除非你能提供一个更坚实的理由,为什么你认为你需要这个。你可以解释一下,你是什么感觉,你试图离开这里的地形?在我看来,这并不是一个很好的结构化日志,可以用来进行分析,但也许我错过了你想要做的事情。如果你可以发布你当前得到的输出以及你想要的,那么这将是有用的。编辑原始帖子会有帮助的,如果你可以模拟JSON输出的样子以及它在ElasticSearch中的用处,或者甚至解释为什么你希望保留此输出以供分析。编辑原始姿势这不是在地形上是可行的,我甚至看不到一个简单的方法来改变你想要的东西。您可以尝试在上提出此功能的请求,但我不确定是否会有很多人对此感兴趣,除非您能够提供更可靠的理由来解释为什么您认为需要此功能。