Date field being converted to timestamps

event.get("@timestamp").to_f returns the number of seconds since the epoch (.to_f includes fractional seconds). You can format number of second since epoch as a date using strftime

    ruby {
        code => '
            t = Time.at(event.get("@timestamp").to_f)
            event.set("someField", t.strftime("%Y-%m-%d"))
        '
    }
2 Likes