How to convert nanoseconds to milliseconds

I have a timestamp as nanoseconds in an access log that I want to store in ES. I understand that the timestamp in ES is stored as milliseconds and that I'll need to convert. Will I have to use mutate and gsub to trim the last six digits from my nanoseconds timestamp? If so how would I go about that?

Thanks, Steve.

You should be able to use a mutate filter,

mutate {
    gsub => ["fieldname", "\d{6}$", ""]

or a ruby filter if you want actual arithmetics.

1 Like

Many thanks @magnusbaeck that's exactly what I was looking for.

Thanks, Steve.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.