Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add capacity to reformat datas for mongodb output plugin #12261

Closed
nicho2 opened this issue Nov 18, 2022 · 4 comments
Closed

add capacity to reformat datas for mongodb output plugin #12261

nicho2 opened this issue Nov 18, 2022 · 4 comments
Assignees
Labels
feature request Requests for new plugin and for new features to existing plugins

Comments

@nicho2
Copy link

nicho2 commented Nov 18, 2022

Use Case

Hello,
I have some datas with json nested fields , and i search to send it in mongodb in a json format

3ddlmlite_diag_devices,device_id=00:80:E1:0B:14:31,host=FRL17172,type=diagnostic F4CE36DBF3AA2794="{"shortAddress": "0000", "status": "online"}" 00047400001212AC="{"shortAddress": "AB1A", "status": "online"}" 0000004740000AEFC89="{"status": "offline"}" 1668696305161661200

is-it possible to have this keyword:

data_format = "json"

json_nested_fields_include = ["*"]

json_transformation = '''$merge([fields, {"tags": tags, "timestamp": $fromMillis(timestamp*1000)}])'''

Thanks

Expected behavior

have in mongo:

{
	"00047400001212AC": {
		"shortAddress": "AB1A",
		"status": "online"
	},
	"0004740000AEFC89": {
		"status": "offline"
	},
	"F4CE36DBF3AA2794": {
		"shortAddress": "0000",
		"status": "online"
	},
	"tags": {
		"device_id": "00:80:E1:0B:14:31",
		"host": "FRL17172",
		"type": "diagnostic"
	},
    "timestamp": {
        "$date": "2022-11-17T15:25:40.000Z"
    },
 "_id": {
        "$oid": "637652793f05dd8a1aa7f4b2"
    },
}

Actual behavior

I have

{
    "timestamp": {
        "$date": "2022-11-17T15:25:40.000Z"
    },
    "tags": {
        "device_id": "00:80:E1:0B:14:31",
        "host": "FRL17172",
        "type": "diagnostic"
    },
    "00047400001212AC": "{\"shortAddress\": \"AB1A\", \"status\": \"online\"}",
    "_id": {
        "$oid": "637652793f05dd8a1aa7f4b2"
    },
    "0004740000AEFC89": "{\"status\": \"offline\"}",
    "F4CE36DBF3AA2794": "{\"shortAddress\": \"0000\", \"status\": \"online\"}"
}

Additional info

No response

@nicho2 nicho2 added the feature request Requests for new plugin and for new features to existing plugins label Nov 18, 2022
@powersj
Copy link
Contributor

powersj commented Nov 18, 2022

@srebhan can your recent PR #12260 help in this case?

@nicho2
Copy link
Author

nicho2 commented Nov 18, 2022

Hello,
@srebhan's evolution have help me very very much (with mqtt) .
Now it's new request to can change format also in the mongodb output plugin.
Actually this plugin haven't this capacity

@srebhan
Copy link
Member

srebhan commented Nov 24, 2022

@powersj the mongodb plugin doesn't use the JSON serializer. I have to read more into the code to see how to implement this...

@srebhan srebhan self-assigned this Nov 24, 2022
@srebhan
Copy link
Member

srebhan commented Jul 12, 2023

@nicho2 looking at this feature-request a bit more I think it is not feasible to implement a custom mapping for MongoDB. Closing this as won't fix...

@srebhan srebhan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

3 participants