Skip to content

how to use a parser to get epoch time from http json input #9950

Closed Answered by jjgrinwis
jjgrinwis asked this question in Q&A
Discussion options

You must be logged in to vote

lua script to the rescue:

function set_timestamp(tag, timestamp, record)
    local new_ts = record["reqTimeSec"]
    if new_ts then
        return 1, new_ts, record
    end
    return 1, timestamp, record
end

and the result:

[1] ds.log: [[1739818239.000000000, {}], {"reqId"=>"1239f220", "reqTimeSec"=>1739818239}]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jjgrinwis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant