Jie Yin, thank you for posting this query here on Microsoft Q&A.
I used the JSON logs shared in question and was able to get the logs in new columns created:
I used the following transform query:
source | extend d=todynamic(RawData) | project fields = tostring(d.fields), tags = tostring(d.tags), name = tostring(d.name), TimeGenerated = todatetime(d.TimeGenerated)
The following are things which needs to be take care in this scenario:
- json RawData needs to be converted to
dynamic
type for it to be available for querying and populating new columns. - Because the
TimeGenerated
column is being overwritten, ensure that the value being passed on your local machine are indeed correct UTC time. Otherwise, it might create confusion when you try to query Log Analytics workspace usingorder by
clause.
Hope this helps.
If the answer did not help, please add more context/follow-up question for it, and we will help you out. Else, if the answer helped, please click Accept answer so that it can help others in the community looking for help on similar topics.