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

How to Map a json inside a json to column #126

Open
Happylinzy opened this issue Mar 7, 2022 · 1 comment
Open

How to Map a json inside a json to column #126

Happylinzy opened this issue Mar 7, 2022 · 1 comment

Comments

@Happylinzy
Copy link

If I have a JSON {"id":7, "name":"bob"}, I can use
column_mapping 'id:id, name:name' .

But, for example, I have a JSON like this :
{"id":{"myid":7}, "name":"bob"}

How can I map myid to the column id?

@ghaythta
Copy link

ghaythta commented May 6, 2024

use the trasnfrom record to extract the fields , then use the new vars to inster into the table

ex:

@type record_transformer
enable_ruby true

data ${record.to_json} # Convert full JSON log data to string under "data"
created_at ${Time.now.utc.iso8601} # Store current UTC time

change record.to_json with record["filed"] or something like this, double check the ruby syntax

then in the table:


table table_name
column_mapping 'data:data,created_at:created_at'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants