我正在尝试获取应用程序名称并打印其与嵌入在值参数中的特定键对应的 apiDefinition。我收到错误“无法使用字符串索引数组”,因为我不太擅长 jq,尤其是嵌套的 json,请帮忙
对于具有“XXXXX / dtsemea / deployments / env”的键,我需要获取专门要打印的值,即“应用程序”(cc,bc,pc,cm)及其对应的“apiDefinitions”,如下所示嵌套。
尝试了以下查询来获取
jq -jr "[.Items[] | select (.key.S == \"XXXXX/dtsemea/deployments/env\" and .id.S == \"dev\")] | select(.value.S.\"applications\")" filename
格式化时无法使用自动换行选项。抱歉,值太长
实际文件 JSON 条目
{
"Items": [
{
"value": {
"S": "{\"carrierId\":\"XXXXX\",\"clusterId\":\"dtsemea\",\"environmentId\":\"dev\",\"phase\":\"DEPLOYED\",\"**applications**\":{**\"cc\"**:{\"build\":{\"id\":\"cc/49/50\",\"application\":\"cc\",\"image\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:cleanCenter-50\",\"timestamp\":\"1658226573\",\"datetime\":\"2022-07-19 11:29:33\",\"project\":\"dtsemea\",\"sourceBuildNumber\":\"49\",\"buildNumber\":\"50\",\"commitHash\":\"0e8c883c16ab4ecbea6061355e9dc53ed4bc8e19\",\"branch\":\"refs/heads/develop\",\"metadata\":{\"platformVersion\":\"50.5.100\",\"docker\":{\"baseImage\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:cc-base-1.0.14\",\"labels\":{\"org.opencontainers.image.authors\":\"[email protected]\",\"org.opencontainers.image.ref.name\":\"bank-suite/clean-center\",\"com.XXXXX.metadata.docker.base-image\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:cc-base-1.0.14\",\"org.opencontainers.image.url\":\"https://stash.XXXXX.com/projects/PORTA/repos/assembly-docker-base\",\"pod\":\"badside\",\"org.opencontainers.image.revision\":\"0e8c883c16ab4ecbea6061355e9dc53ed4bc8e19\",\"com.XXXXX.team-slack\":\"ask-kitiw\",\"maintainer\":\"[email protected]\",\"org.opencontainers.image.documentation\":\"https://confluence.XXXXX.com/display/ORANGE/GWCP+bankSuite+base+docker+image+versions\",\"org.opencontainers.image.title\":\"clean-center\",\"com.XXXXX.metadata.platform-version\":\"50.5.100\",\"org.opencontainers.image.vendor\":\"XXXXX\",\"com.XXXXX.apm.javaagent-location\":\"/opt/apm/dd-java-agent.jar\",\"org.opencontainers.image.version\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:cleanCenter-50\",\"com.XXXXX.dept\":\"202\",\"com.XXXXX.source-build-number\":\"49\",\"com.XXXXX.apm.javaagent-version\":\"0.92.0\",\"org.opencontainers.image.description\":\"Image containing the clean Center application.\"}}}},\"jdbcUrl\":\"jdbc:postgresql://XXXXX-bankplatform-dev.cluster-cbad2oyfqxmm.us-east-1.rds.amazonaws.com:5432/XXXXX_dtsemea_dev_cc?password=${password}\",\"url\":\"https://cc-dev-dtsemea.XXXXX.galileo-algebraic.XXXXX.net\",\"lastUpdated\":1658233021962,\"catalinaOpts\":[\"-XX:+UseNUMA\",\"-verbose:gc\",\"-XX:+PrintGCDetails\",\"-Denv=cloud-dev\",\"-Dgw.config.external.logging.file='/opt/tomcat/webapps/ROOT/modules/configuration/config/logging/log4j2-json.xml'\",\"-Dlog4j2.formatMsgNoLookups=true\"],\"runtimePropertyDirectoryURL\":\"https://tenant-XXXXX-dtsemea-orange-dev-storage.s3.us-east-1.amazonaws.com/dev/cc/runtime-properties/\",\"hiddenVariables\":[\"PLUGIN_AWS_SECRET_NAMES\",\"PLUGIN_INTERNAL_S3_PREFIX\",\"PLUGIN_AWS_SECRET_TAGS\",\"PLUGIN_AWS_REGION\",\"PLUGIN_DMS_S3_SECRET_ACCESS_KEY\",\"PLUGIN_S3_BUCKET_NAME\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\",\"PLUGIN_ARCHIVING_S3_PREFIX\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\"],**\"apiDefinitions\"**:[\"/rest/common/v1/openapi.json\",\"/rest/clean/v1/openapi.json\",\"/rest/admin/v1/openapi.json\"],\"apmEnabled\":false,\"updatePhase\":\"UpToDate\",\"lastStatus\":null,\"hvqUrl\":\"\",\"enableApiGateway\":true,\"name\":\"cc\",\"envVars\":{\"PLUGIN_AWS_SECRET_NAMES\":\"tenant_XXXXX_dev_cc_387e0582-eb15-4181-a8d7-823c50ac101c\",\"PLUGIN_AWS_SECRET_TAGS\":\"environment=dev,all product=cc project=dtsemea tenant=XXXXX\",\"PLUGIN_AWS_REGION\":\"us-east-1\",\"PLUGIN_DMS_S3_SECRET_ACCESS_KEY\":\"jgfhnjklfdgxxxx\",\"PLUGIN_DMS_S3_BUCKET_NAME\":\"dtsemeadmssamplebucket\",\"PLUGIN_DMS_S3_ACCESS_KEY\":\"AKIAgdfhfghfghPIFGA\",\"PLUGIN_DMS_S3_REGION_ID\":\"eu-central-1\",\"PLUGIN_DMS_S3_FOLDER_NAME\":\"cleans/\",\"PLUGIN_S3_BUCKET_NAME\":\"tenant-XXXXX-dtsemea-orange-dev-storage\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\":\"dev/cc/inbound-files/pending/\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\":\"dev/cc/inbound-files/processed/\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\":\"dev/cc/inbound-files/failed/\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\":\"dev/cc/outbound-files/\",\"PLUGIN_ARCHIVING_S3_PREFIX\":\"dev/cc/archiving/\",\"PLUGIN_INTERNAL_S3_PREFIX\":\"dev/cc/internal/\",\"TZ\":\"America/Los_Angeles\",\"GW_TENANT\":\"XXXXX\",\"GW_PROPERTY_SERVICE_DISABLED\":\"false\"},\"clusterNodes\":[{\"role\":\"all\",\"replicas\":1}],\"requests\":{\"cpu\":\"1\",\"memory\":\"10Gi\"},\"limits\":{\"cpu\":\"4\",\"memory\":\"10Gi\"},\"livenessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"20\",\"initialDelaySeconds\":\"240\",\"periodSeconds\":\"60\",\"timeoutSeconds\":\"90\"},\"readinessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"3\",\"initialDelaySeconds\":\"30\",\"periodSeconds\":\"10\",\"timeoutSeconds\":\"1\"},\"efsMounts\":null,\"applicationStatus\":\"Running\",\"enableMtlsAuth\":true},**\"bc\"**:{\"build\":{\"id\":\"bc/58/53\",\"application\":\"bc\",\"image\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:bakingCenter-53\",\"timestamp\":\"1657893857\",\"datetime\":\"2022-07-15 15:04:17\",\"project\":\"dtsemea\",\"sourceBuildNumber\":\"58\",\"buildNumber\":\"53\",\"commitHash\":\"ee25d7c2d4c272321586d10b9a162ea5db546fec\",\"branch\":\"refs/heads/develop\",\"metadata\":{\"platformVersion\":\"50.5.100\",\"docker\":{\"baseImage\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:bc-base-1.0.14\",\"labels\":{\"org.opencontainers.image.authors\":\"[email protected]\",\"org.opencontainers.image.ref.name\":\"bank-suite/baking-center\",\"com.XXXXX.metadata.docker.base-image\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:bc-base-1.0.14\",\"org.opencontainers.image.url\":\"https://stash.XXXXX.com/projects/PORTA/repos/assembly-docker-base\",\"pod\":\"badside\",\"org.opencontainers.image.revision\":\"ee25d7c2d4c272321586d10b9a162ea5db546fec\",\"com.XXXXX.team-slack\":\"ask-kitiw\",\"maintainer\":\"[email protected]\",\"org.opencontainers.image.documentation\":\"https://confluence.XXXXX.com/display/ORANGE/GWCP+bankSuite+base+docker+image+versions\",\"org.opencontainers.image.title\":\"baking-center\",\"com.XXXXX.metadata.platform-version\":\"50.5.100\",\"org.opencontainers.image.vendor\":\"XXXXX\",\"com.XXXXX.apm.javaagent-location\":\"/opt/apm/dd-java-agent.jar\",\"org.opencontainers.image.version\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:bakingCenter-53\",\"com.XXXXX.dept\":\"202\",\"com.XXXXX.source-build-number\":\"58\",\"com.XXXXX.apm.javaagent-version\":\"0.92.0\",\"org.opencontainers.image.description\":\"Image containing the baking Center application.\"}}}},\"jdbcUrl\":\"jdbc:postgresql://XXXXX-bankplatform-dev.cluster-cbad2oyfqxmm.us-east-1.rds.amazonaws.com:5432/XXXXX_dtsemea_dev_bc?password=${password}\",\"url\":\"https://bc-dev-dtsemea.XXXXX.galileo-algebraic.XXXXX.net\",\"lastUpdated\":1658233021962,\"catalinaOpts\":[\"-XX:+UseNUMA\",\"-verbose:gc\",\"-XX:+PrintGCDetails\",\"-Denv=cloud-dev\",\"-Dgw.config.external.logging.file='/opt/tomcat/webapps/ROOT/modules/configuration/config/logging/log4j2-json.xml'\",\"-Dlog4j2.formatMsgNoLookups=true\"],\"runtimePropertyDirectoryURL\":\"https://tenant-XXXXX-dtsemea-orange-dev-storage.s3.us-east-1.amazonaws.com/dev/bc/runtime-properties/\",\"hiddenVariables\":[\"PLUGIN_AWS_SECRET_NAMES\",\"PLUGIN_INTERNAL_S3_PREFIX\",\"PLUGIN_AWS_SECRET_TAGS\",\"PLUGIN_AWS_REGION\",\"PLUGIN_S3_BUCKET_NAME\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\",\"PLUGIN_ARCHIVING_S3_PREFIX\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\"],**\"apiDefinitions\"**:[],\"apmEnabled\":false,\"updatePhase\":\"UpToDate\",\"lastStatus\":null,\"hvqUrl\":\"\",\"enableApiGateway\":true,\"name\":\"bc\",\"envVars\":{\"PLUGIN_AWS_SECRET_NAMES\":\"tenant_XXXXX_dev_bc_680769d1-4894-467c-8877-6f1a0b550924\",\"PLUGIN_AWS_SECRET_TAGS\":\"environment=dev,all product=bc project=dtsemea tenant=XXXXX\",\"PLUGIN_AWS_REGION\":\"us-east-1\",\"PLUGIN_S3_BUCKET_NAME\":\"tenant-XXXXX-dtsemea-orange-dev-storage\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\":\"dev/bc/inbound-files/pending/\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\":\"dev/bc/inbound-files/processed/\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\":\"dev/bc/inbound-files/failed/\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\":\"dev/bc/outbound-files/\",\"PLUGIN_ARCHIVING_S3_PREFIX\":\"dev/bc/archiving/\",\"PLUGIN_INTERNAL_S3_PREFIX\":\"dev/bc/internal/\",\"TZ\":\"America/Los_Angeles\",\"GW_TENANT\":\"XXXXX\",\"GW_PROPERTY_SERVICE_DISABLED\":\"false\"},\"clusterNodes\":[{\"role\":\"all\",\"replicas\":1}],\"requests\":{\"cpu\":\"1\",\"memory\":\"10Gi\"},\"limits\":{\"cpu\":\"4\",\"memory\":\"10Gi\"},\"livenessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"20\",\"initialDelaySeconds\":\"240\",\"periodSeconds\":\"60\",\"timeoutSeconds\":\"90\"},\"readinessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"3\",\"initialDelaySeconds\":\"30\",\"periodSeconds\":\"10\",\"timeoutSeconds\":\"1\"},\"efsMounts\":null,\"applicationStatus\":\"Running\",\"enableMtlsAuth\":true},**\"pc\"**:{\"build\":{\"id\":\"pc/115/94\",\"application\":\"pc\",\"image\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:purityCenter-94\",\"timestamp\":\"1657895180\",\"datetime\":\"2022-07-15 15:26:20\",\"project\":\"dtsemea\",\"sourceBuildNumber\":\"115\",\"buildNumber\":\"94\",\"commitHash\":\"4d438348bb4183c625f3ce6a67250ca1cf967550\",\"branch\":\"refs/heads/develop\",\"metadata\":{\"platformVersion\":\"50.5.100\",\"docker\":{\"baseImage\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:pc-base-1.0.14\",\"labels\":{\"org.opencontainers.image.authors\":\"[email protected]\",\"org.opencontainers.image.ref.name\":\"bank-suite/purity-center\",\"com.XXXXX.metadata.docker.base-image\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:pc-base-1.0.14\",\"org.opencontainers.image.url\":\"https://stash.XXXXX.com/projects/PORTA/repos/assembly-docker-base\",\"pod\":\"badside\",\"org.opencontainers.image.revision\":\"4d438348bb4183c625f3ce6a67250ca1cf967550\",\"com.XXXXX.team-slack\":\"ask-kitiw\",\"maintainer\":\"[email protected]\",\"org.opencontainers.image.documentation\":\"https://confluence.XXXXX.com/display/ORANGE/GWCP+bankSuite+base+docker+image+versions\",\"org.opencontainers.image.title\":\"purity-center\",\"com.XXXXX.metadata.platform-version\":\"50.5.100\",\"org.opencontainers.image.vendor\":\"XXXXX\",\"com.XXXXX.apm.javaagent-location\":\"/opt/apm/dd-java-agent.jar\",\"org.opencontainers.image.version\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:purityCenter-94\",\"com.XXXXX.dept\":\"202\",\"com.XXXXX.source-build-number\":\"115\",\"com.XXXXX.apm.javaagent-version\":\"0.92.0\",\"org.opencontainers.image.description\":\"Image containing the purity Center application.\"}}}},\"jdbcUrl\":\"jdbc:postgresql://XXXXX-bankplatform-dev.cluster-sdffsdf.us-east-1.rds.amazonaws.com:5432/XXXXX_dtsemea_dev_pc?password=${password}\",\"url\":\"https://pc-dev-dtsemea.XXXXX.galileo-algebraic.XXXXX.net\",\"lastUpdated\":1658233021962,\"catalinaOpts\":[\"-XX:+UseNUMA\",\"-verbose:gc\",\"-XX:+PrintGCDetails\",\"-Denv=cloud-dev\",\"-Dgw.config.external.logging.file='/opt/tomcat/webapps/ROOT/modules/configuration/config/logging/log4j2-json.xml'\",\"-Dlog4j2.formatMsgNoLookups=true\"],\"runtimePropertyDirectoryURL\":\"https://tenant-XXXXX-dtsemea-orange-dev-storage.s3.us-east-1.amazonaws.com/dev/pc/runtime-properties/\",\"hiddenVariables\":[\"PLUGIN_AWS_SECRET_NAMES\",\"PLUGIN_INTERNAL_S3_PREFIX\",\"PLUGIN_AWS_SECRET_TAGS\",\"PLUGIN_AWS_REGION\",\"PLUGIN_S3_BUCKET_NAME\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\",\"PLUGIN_ARCHIVING_S3_PREFIX\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\"],**\"apiDefinitions\"**:[\"/rest/common/v1/openapi.json\",\"/rest/account/v1/openapi.json\",\"/rest/purity/v1/openapi.json\",\"/rest/job/v1/openapi.json\",\"/rest/productdefinition/v1/openapi.json\",\"/rest/admin/v1/openapi.json\"],\"apmEnabled\":false,\"updatePhase\":\"UpToDate\",\"lastStatus\":null,\"hvqUrl\":\"\",\"enableApiGateway\":true,\"name\":\"pc\",\"envVars\":{\"PLUGIN_AWS_SECRET_NAMES\":\"tenant_XXXXX_dev_pc_5919caa0-d292-49e0-9ef5-1b9874aac4f6\",\"PLUGIN_AWS_SECRET_TAGS\":\"environment=dev,all product=pc project=dtsemea tenant=XXXXX\",\"PLUGIN_AWS_REGION\":\"us-east-1\",\"PLUGIN_S3_BUCKET_NAME\":\"tenant-XXXXX-dtsemea-orange-dev-storage\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\":\"dev/pc/inbound-files/pending/\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\":\"dev/pc/inbound-files/processed/\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\":\"dev/pc/inbound-files/failed/\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\":\"dev/pc/outbound-files/\",\"PLUGIN_ARCHIVING_S3_PREFIX\":\"dev/pc/archiving/\",\"PLUGIN_INTERNAL_S3_PREFIX\":\"dev/pc/internal/\",\"TZ\":\"America/Los_Angeles\",\"GW_TENANT\":\"XXXXX\",\"GW_PROPERTY_SERVICE_DISABLED\":\"false\"},\"clusterNodes\":[{\"role\":\"all\",\"replicas\":1}],\"requests\":{\"cpu\":\"1\",\"memory\":\"40Gi\"},\"limits\":{\"cpu\":\"4\",\"memory\":\"40Gi\"},\"livenessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"20\",\"initialDelaySeconds\":\"240\",\"periodSeconds\":\"60\",\"timeoutSeconds\":\"90\"},\"readinessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"3\",\"initialDelaySeconds\":\"30\",\"periodSeconds\":\"10\",\"timeoutSeconds\":\"1\"},\"efsMounts\":null,\"applicationStatus\":\"Running\",\"enableMtlsAuth\":true},**\"cm\"**:{\"build\":{\"id\":\"cm/51/49\",\"application\":\"cm\",\"image\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:concealManager-49\",\"timestamp\":\"1655983901\",\"datetime\":\"2022-06-23 12:31:41\",\"project\":\"dtsemea\",\"sourceBuildNumber\":\"51\",\"buildNumber\":\"49\",\"commitHash\":\"1419dbe9ad15dc156cdf8142290c7c8d71d297ac\",\"branch\":\"refs/heads/develop\",\"metadata\":{\"platformVersion\":\"50.5.100\",\"docker\":{\"baseImage\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:cm-base-1.0.14\",\"labels\":{\"org.opencontainers.image.authors\":\"[email protected]\",\"org.opencontainers.image.ref.name\":\"bank-suite/conceal-manager\",\"com.XXXXX.metadata.docker.base-image\":\"996752749769.dkr.ecr.us-west-2.amazonaws.com/bankplatform:cm-base-1.0.14\",\"org.opencontainers.image.url\":\"https://stash.XXXXX.com/projects/PORTA/repos/assembly-docker-base\",\"pod\":\"badside\",\"org.opencontainers.image.revision\":\"1419dbe9ad15dc156cdf8142290c7c8d71d297ac\",\"com.XXXXX.team-slack\":\"ask-kitiw\",\"maintainer\":\"[email protected]\",\"org.opencontainers.image.documentation\":\"https://confluence.XXXXX.com/display/ORANGE/GWCP+bankSuite+base+docker+image+versions\",\"org.opencontainers.image.title\":\"conceal-manager\",\"com.XXXXX.metadata.platform-version\":\"50.5.100\",\"org.opencontainers.image.vendor\":\"XXXXX\",\"com.XXXXX.apm.javaagent-location\":\"/opt/apm/dd-java-agent.jar\",\"org.opencontainers.image.version\":\"6544653081536.dkr.ecr.us-east-1.amazonaws.com/galileo-1-us-east-1-XXXXX-bankplatform/dtsemea:concealManager-49\",\"com.XXXXX.dept\":\"202\",\"com.XXXXX.source-build-number\":\"51\",\"com.XXXXX.apm.javaagent-version\":\"0.92.0\",\"org.opencontainers.image.description\":\"Image containing the conceal Manager application.\"}}}},\"jdbcUrl\":\"jdbc:postgresql://XXXXX-bankplatform-dev.cluster-cbad2oyfqxmm.us-east-1.rds.amazonaws.com:5432/XXXXX_dtsemea_dev_cm?password=${password}\",\"url\":\"https://cm-dev-dtsemea.XXXXX.galileo-algebraic.XXXXX.net\",\"lastUpdated\":1658233021962,\"catalinaOpts\":[\"-XX:+UseNUMA\",\"-verbose:gc\",\"-XX:+PrintGCDetails\",\"-Denv=cloud-dev\",\"-Dgw.config.external.logging.file='/opt/tomcat/webapps/ROOT/modules/configuration/config/logging/log4j2-json.xml'\",\"-Dlog4j2.formatMsgNoLookups=true\"],\"runtimePropertyDirectoryURL\":\"https://tenant-XXXXX-dtsemea-orange-dev-storage.s3.us-east-1.amazonaws.com/dev/cm/runtime-properties/\",\"hiddenVariables\":[\"PLUGIN_AWS_SECRET_NAMES\",\"PLUGIN_INTERNAL_S3_PREFIX\",\"PLUGIN_AWS_SECRET_TAGS\",\"PLUGIN_AWS_REGION\",\"PLUGIN_S3_BUCKET_NAME\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\",\"PLUGIN_ARCHIVING_S3_PREFIX\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\"],**\"apiDefinitions\"**:[\"/rest/common/v1/openapi.json\",\"/rest/admin/v1/openapi.json\"],\"apmEnabled\":false,\"updatePhase\":\"UpToDate\",\"lastStatus\":null,\"hvqUrl\":\"\",\"enableApiGateway\":true,\"name\":\"cm\",\"envVars\":{\"PLUGIN_AWS_SECRET_NAMES\":\"tenant_XXXXX_dev_cm_01889119-0ed7-49d3-be97-b605d3ced9e6\",\"PLUGIN_AWS_SECRET_TAGS\":\"environment=dev,all product=cm project=dtsemea tenant=XXXXX\",\"PLUGIN_AWS_REGION\":\"us-east-1\",\"PLUGIN_S3_BUCKET_NAME\":\"tenant-XXXXX-dtsemea-orange-dev-storage\",\"PLUGIN_INBOUND_S3_INPUT_PREFIX\":\"dev/cm/inbound-files/pending/\",\"PLUGIN_INBOUND_S3_ARCHIVE_PREFIX\":\"dev/cm/inbound-files/processed/\",\"PLUGIN_INBOUND_S3_FAILED_PREFIX\":\"dev/cm/inbound-files/failed/\",\"PLUGIN_OUTBOUND_S3_OUTPUT_PREFIX\":\"dev/cm/outbound-files/\",\"PLUGIN_ARCHIVING_S3_PREFIX\":\"dev/cm/archiving/\",\"PLUGIN_INTERNAL_S3_PREFIX\":\"dev/cm/internal/\",\"TZ\":\"America/Los_Angeles\",\"GW_TENANT\":\"XXXXX\",\"GW_PROPERTY_SERVICE_DISABLED\":\"false\"},\"clusterNodes\":[{\"role\":\"all\",\"replicas\":1}],\"requests\":{\"cpu\":\"1\",\"memory\":\"10Gi\"},\"limits\":{\"cpu\":\"4\",\"memory\":\"10Gi\"},\"livenessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"20\",\"initialDelaySeconds\":\"240\",\"periodSeconds\":\"60\",\"timeoutSeconds\":\"90\"},\"readinessProbe\":{\"httpGet\":{\"path\":\"/rest/system/v1/server/health/live\"},\"successThreshold\":\"1\",\"failureThreshold\":\"3\",\"initialDelaySeconds\":\"30\",\"periodSeconds\":\"10\",\"timeoutSeconds\":\"1\"},\"efsMounts\":null,\"applicationStatus\":\"Running\",\"enableMtlsAuth\":true}},\"timezone\":\"America/Los_Angeles\",\"databaseProvisioner\":\"http://databaseservice-app.ddd.svc.cluster.local:8082\",\"rdsCluster\":null,\"user\":\"[email protected]\",\"serverMode\":\"dev\",\"environmentType\":\"dev\",\"id\":\"383ac368-52e4-4b4a-8807-1302806625c7\",\"phaseDetails\":\"\",\"cluster\":{\"endpoint\":\"https://6F78890FFF95FBCD54FE039D8E79108C.gr7.us-east-1.eks.amazonaws.com\",\"clusterName\":\"galileo-1-us-east-1\",\"caCert\":\"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1ETXhOVEF3TXpFMU0xb1hEVE14TURNeE16QXdNekUxTTFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvzxczxczxczxczxczxcQ2dnRUJBTlhlCkNPZVg2Snk3M2xpZ0x0QXljREUvaEpCZXczRStVeElZeDF4a2ZUelExNEl6RVU0U0wwYWJ5RGJaS0QvU2hKSGsKSHM3K3hEQ3ltSWVYbjNMQk9nOFJveEZ6anRvcnFjT1I1bkFZRGc1aEo2NEpEVjBtbHZmMXBUY1BXY1VHQ1BHcQpnSVVHcTNVbUtITUtRNitBRnhKRFFYbjZUkdWTWsveGQzZ0VQM2tub0kzTFhzdXlMVmhFeEplQVJKb0tRd0xranRsUDM3MFo2eHJVUTJWcXFwNklnNWVWa2wKVExHeXpGRXRBYm91Zk1VRkl0UEJrYmVsZkNhRno1czB4OFViM1ZpRzdJL0FsNGdnMzlRYkRLYnVYRW9jam4wZwpiaXZrYVpFRms5Y1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFORDc5RUZpOHVvbG1JR3REbDJ4Uk82VlY1T2QKVlB4YWJFRWpaL3ZWZFV6WFBicWlTdXNYWkpiVVlPRXQwcFhXNnRCM1c3Y2pxU1NOeHJFRzFzVU5obEc1bTkyago0c1NhZmQzdk1wRzRyTFl3NFRNOTljd0JFU2oyd1hxcXkwMVB3cUVjZGxVT1poWWhiUFc4SEJsMSt3eEVjQU50CnpnRURuM044bGMxYUkxbCticXpIa2NjTFFRdy9jVzZhSHRmRGxwTHpyL1ZtOUREUUF6ekhqbTBram5TQzR5OGYKRTRqa1IyZG5OT1dCZXYvZDNGVjVGUzNraXhnTlNBVUR2M0Y2VXhZK2k1MGlNZVp4VkVMcitFV1VBRlRxZjFENwpPZHk1azFKWC9IaTZ4RVE0K0VzSjIvUG0xKzZ6aStHR1hwcDJYUStqNFdDSnJXd1VLSDl2WUx6YlVWQT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=\",\"awsAccountId\":\"555555536\",\"region\":\"us-east-1\"}}"
},
"key": {
"S": "XXXXX/dtsemea/deployments/env"
},
"id": {
"S": "dev"
}
},
{
"value": {
"S": "\"algebraic\""
},
"key": {
"S": "romeo/pcpre/galaxy"
},
"id": {
"S": "0"
}
}
],
"Count": 91042,
"ScannedCount": 91042,
"ConsumedCapacity": null
}
格式化时无法使用自动换行选项。抱歉,值太长
答案1
jq 无法将“嵌套 JSON”识别为 JSON – 该S
值实际上只是一个字符串。要实现此功能,您需要将该字符串输入到其他jq实例:
cat foo.json \
| jq -r '.Items[]
| select(.key.S == "XXXXX/dtsemea/deployments/env")
| select(.id.S == "dev")
| .value.S' \
| jq -r '.applications'