Tag: json

stream利的JSONparsing器:获取无法parsing的消息

在我目前的项目中,我必须处理不同types的日志logging在一个来源(http)中进入我的fluentd。 大多数条目是JSON格式的,但在某些情况下,我必须处理明文logging。 (例如,在设置日志库之前的例外情况)。 我如何处理我的fluentd-config中的这种情况? 我的详细设置:我使用Docker的fluentd-logging-driver作为一些带有node.js-app的容器。 node.js-app有一个日志logging库,它以json格式将所有内容logging到stdout / stderr。 每个运行时exception也将被格式化为json。 我的问题只发生在node.js无法启动(如缺less依赖关系..)。 在这种情况下,exception将被格式化为纯文本。 这会导致fluentd中的错误,因为它不能被parsing。 Fluentd也运行在一个容器中。 我的第一个方法是将fluentd-own-messages(包括parsing器错误消息)也logging到我的elasticsearch中,但是原来的消息get的来源是这种方法丢失的。 我运行了大约15个不同的服务,所以我真的需要我的exception的“源”。 <source> @type forward port 24224 </source> <filter fluent.**> @type record_transformer <record> fields.module fluentd #fields.module is my identifier for the source </record> </filter> <match fluent.**> @include elastic.conf #elastic configuration is in a separate file </match> # JSON-Parse <filter **> @type parser […]

我们可以在运行时重命名packer.json文件中给出的图像名称的“packer build”命令输出图像吗?

我需要根据参数文件重命名图像。 在执行packer.json packer build命令时,我们如何在运行时packer.json映像命名? 我的要求是devise一个自动化的图像构build环境,从最终用户接受packer.json文件并构build机器映像和名称。 它遵循一定的准则,不pipe最终用户提供的名称如何。

我如何分配足够的内存运行Object.stringify没有内存/ RangeError

我使用节点实例发送非常大的JSON文件。 JSON文件大约是150MB。 当我在生产中运行它时,出现以下错误: RangeError: Invalid string length at join (native) at Object.stringify (native) at stringify (/opt/biz/fishco/api/node_modules/json-stringify-safe/stringify.js:5:15) at safeStringify (/opt/biz/fishco/api/node_modules/request/lib/helpers.js:24:11) at Request.json (/opt/biz/fishco/api/node_modules/request/request.js:1222:17) at Request.init (/opt/biz/fishco/api/node_modules/request/request.js:407:10) at Request.RP$initInterceptor [as init] (/opt/biz/fishco/api/node_modules/request-promise-core/configure/request2.js:45:29) at new Request (/opt/biz/fishco/api/node_modules/request/request.js:128:8) at request (/opt/biz/fishco/api/node_modules/request/index.js:54:10) at MachineModel.sendModelToML (/opt/biz/fishco/api/dist/src/biz/models/machine.model.js:28:16) at MachineController.<anonymous> (/opt/biz/fishco/api/dist/src/biz/controllers/machine.controller.js:44:35) at next (native) at fulfilled (/opt/biz/fishco/api/dist/src/biz/controllers/machine.controller.js:4:58) at process._tickCallback (internal/process/next_tick.js:103:7) 一些快速googeling说这可能是VM内存问题,并扩大HEAP大小。 我的服务器有32GB的RAM。 我的节点进程是dockerized。 […]

Docker日志将JSON日志解释为string

我们的Go服务器以JSON的forms输出日志到stdout,每一行看起来像下面这样: {"time": "2017-06-01 14:00:00", "message": "Something happened", "level": "DEBUG"} 我们的docker-compose使用标准的json-filelogging器,它将每行logging在一个log字段中作为一个转义string,如下所示: { "log": "{\"time\": \"2017-06-01 14:00:00\", \"message\": \"Something happened\", \"level\": \"DEBUG\"}\"", "timestamp": "<the time>", …more fields… } 但是我们不希望将日志字段作为string转义,我们希望将其作为JSONembedded到同一级别: { "log": { "time": "2017-06-01 14:00:00", "message": "Something happened", "level": "DEBUG" }, "timestamp": "<the time>", …more fields… } 这可以实现吗?

CannotStartContainerError提交AWS批处理作业

在AWS Batch我有一个job definition ,一个job queue和一个执行我的AWS Batch jobs的compute environment 。 提交工作后,我发现它在失败的列表中有这个错误: Status reason Essential container in task exited Container message CannotStartContainerError: API error (404): oci runtime error: container_linux.go:247: starting container process caused "exec: \"/var/application/script.sh –file= –key=. 在cloudwatch logs我有: container_linux.go:247: starting container process caused "exec: \"/var/application/script.sh –file=Toulouse.json –key=out\": stat /var/application/script.sh –file=Toulouse.json –key=out: no such file or directory" […]

OpendayLight:如何指定stream表的目的IP地址

我使用OpendayLight ( Carbon SR1 )将stream表发送到交换机,除了使用set-nw-dst-action-case指令外,一切正常。 一旦我使用这个指令,stream程就不能被正确地切换(通过http://opendaylight_ip:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0 ),这是我的json代码来设置stream量: { "flow": [ { "id": "test", "match": { "ethernet-match": { "ethernet-destination": { "address": "02:42:4a:46:fc:02" } } }, "instructions": { "instruction": [ { "order": "0", "apply-actions": { "action": [ { "order": "0", "set-nw-dst-action": { "_Opps": "Remove this action goes normal" "ipv4-address": "192.168.1.3/32" } }, { "order": "1", "set-dl-dst-action": { […]

在docker环境中使用swagger工具的节点:无法parsingJSON / YAML响应

docker容器上的路由不同。 就像 – domain.com/api/client-swagger vs. domain.com:port/client-swagger其他的工程就可以了。 我正在使用json-refs来parsingswagger对象的path,它看起来像这样: const clientSwagger = new Promise(clientResolution => resolveRefsAt(path.join(__dirname, '../api/swagger.json'), { filter: ['relative'] }) .then(resolve => { swaggerTools.initializeMiddleware(results.resolved, (middleware) => { app.use(middleware.swaggerRouter({ controllers: path.join(__dirname, 'routes') })); app.use(middleware.swaggerUi({ swaggerUi: '/client-swagger/', apiDocs: '/client-docs/' })); app.use(errorHandler); resolve({ io, server, app, swaggerDocument: results.resolved }); }); }) ); 该应用程序正在使用快递和swagger工具版本0.10.1。 我已经尝试更改filtertypes,尝试手动导入swagger.json无济于事。 再次 – 在没有住在docker工人的任何环境中工作都很好 这很新鲜,所以如果有关于这方面的一些重要细节被丢弃,请原谅我。 我会提供任何所需的附加信息。 […]

Jq并不强调Docker检查输出

当执行docker-machine inspect命令时,而不是JSON的预期高亮显示版本传送到jq: 我看到下面的纯输出(以cmd或ConEmu): 不知道需要做什么才能启用适当的json突出显示。 这发生在jq版本的Windows 10机器上。 1.5通过Chocolatey安装:

docker中env_file的json插值

我已经成功地把我的应用程序中的json键值放入docker-compose中,如下所示: environment: – 'REDIS_URI={ "host":"redis","port":6379 }' – 'DATABASE_CONNECTION={ "cloud_database": "foo_database": "postgresql://foo_database:foo_database@foo_database/foo_database" }' 但是当我尝试以相同的格式在外部env_file中执行相同的操作时,dockerized flask应用程序无法find数据库连接? 不应该在env_file中工作吗?

错误发生为:w0无法读取带有错误的json文件:无法在使用docker-compose启动couchbase图像时解码JSON对象

我在docker-compose中使用基本版本4.6.3的couchbase映像。 但是我在启动docker-up时遇到下面的错误: couchbase_1 | SUCCESS: init/edit couchbase.docker couchbase_1 | SUCCESS: set hostname for couchbase.docker couchbase_1 | SUCCESS: bucket-create couchbase_1 | ….2017-11-13 09:57:06,301: w0 Fail to read json file with error:No JSON object could be decoded couchbase_1 | . couchbase_1 | bucket: ., msgs transferred… couchbase_1 | : total | last | per sec couchbase_1 | […]