Now

Learn about the Now OTTL converter function.

The Now converter returns the current timestamp of type time.Time.

Syntax: Now()

Input

{
	"_type": "log",
	"timestamp": 1734492333499,
	"body": "time=hostname=SIMPLE|product=Firewall1",
	"resource": {...}
}

Statement

set(attributes["processed_timestamp"], UnixMilli(Now()))

See UnixMilli

Output

{
	"_type": "log",
	"timestamp": 1734492333499,
	"body": "time=hostname=SIMPLE|product=Firewall1",
	"resource": {...},
	"attributes": {
		"processed_timestamp": 1734492333500
	}
}

The current timestamp was recorded at the time of processing and converted into UnixMilli.