Dynamic time variables

You can use dynamic time variables to include timestamps in folder paths, names, and log filenames in DataStream 2. This helps you sort logs in object-based destinations where your stream sends and stores logs, such as Amazon S3, Azure Storage, Google Cloud Storage, and Oracle Cloud.

Dynamic variables

Use {}to enter a dynamic variable in folder paths and upload file prefixes. You can use these variables:

  • %Y for a year. For example, `025.

  • %m for a month (01-12). For example, 03.

  • %d for a day (01-31). For example, 13.

  • %H for an hour (00-23). For example, 15.

Folder path variables

You can combine static values and dynamic variables in a string of up to 255 characters in the Folder path fields to point to the folder path where you want to store logs. On sending a log file to this path, the system resolves dynamic variables into the current date, time, and hour in the UTC standard.

Multiple dynamic variables separated by / within one {}create separate folders. For example, {%Y/%m/%d/} creates this path consisting of three folders: 2020/10/05. Multiple variables joined without a separator create one folder. For example, {%Y}{%m}{%d} creates the 20201005 folder.

Here are the path examples:

Path in configurationPath in destination
logs/{%Y/%m/%d} logs/2022/10/27
{%m}-logs/diagnostics 05-logs/diagnostics
diagnostics/{%Y}/{%m}/{%d}{%H} diagnostics/2022/11/0516

Log file variables

Log files that the system uploads to your destination follow this naming pattern:
<uploadFilePrefix>-{random-string}-{epoch-timestamp}-{random-string}-<uploadFileSuffix>

Depending on the destination, you can customize the <uploadFilePrefix> and <uploadFileSuffix> values for these files.

You can use static values and dynamic variables in a string of up to 200 characters in <uploadFilePrefix> names of log files that you upload to destinations. On sending a log file, the system resolves dynamic variables into the current date, time, and hour. You can use multiple dynamic values separated by -, _, or no separator. Filename prefixes don't allow . characters, as using them may result in errors and data loss. If unspecified, the value defaults to ak.

You can use static values in a string of up to 10 characters in <uploadFileSuffix> names of log files that you upload to destinations of your choice. Filename suffixes don't allow dynamic values, the ., /,%, and ?characters, as using them may result in errors and data loss. If unspecified, the <uploadFileSuffix> value defaults to ds.

Here are the file name examples:

PrefixSuffixFile name
{%Y}-{%m}-{%d} akam 2022-10-27-rps79rkvx-1666884947-dkmzsi6z8-akam
diagnostics{%Y-%m-%d} logs diagnostics2022-12-01-8ds3lufkh-1669908947-m1onxoa16-logs
{%m}-diagnostics delivery 12-diagnostics-dk4j0sh3m-1669856400-9kv08v9oy-delivery
upload-{%m_%d_%H}-filedata upload-04_23_18-file-gao0pip6y-1650736800-981bz2ipd-data
Unspecified (ak by default)Unspecified (ds by default)ak-ae47rr5a8-1650736800-ae47rg6hu-ds

Did this page help you?