Date and Timestamp

Examples:

incidents.csv -- This file contains a set of tickets/incident details

ts_to_datetimestr - Parses input timestamp in milliseconds and converts human readable string

Step 1: Create an empty pipeine datetime_example AIOps studio as shown in the below screenshot

Step 2: Add the following pipeline code/commands into the above created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates set of records (ipaddress, timestampin milliseconds, ##### id) using AIOps studio. ##### Using RDA functionality *dm:filter renamed two column names ##### ipaddresss to IP_Address, time to Alert_Time ##### After renaming is completed, dm:function 'ts_to_datetimestr' is used #### to convert timestamp into human readable format. @dm:empty --> @dm:addrow ipaddress = '10.10.1.1' & time = '1623193065990' & id = 'a1' --> @dm:addrow ipaddress = '10.10.1.2' & time = '1623193065990' & id = 'a2' --> @dm:addrow ipaddress = '10.10.1.3' & time = '1623193065990' & id = 'a3' --> @dm:addrow ipaddress = '10.10.1.4' & time = '1623193065990' & id = 'a4' --> *dm:filter * get id,ipaddress as 'IP_Address',time as 'Alert_time' --> @dm:map attr = 'Alert_time' & func = 'ts_to_datetimestr' & unit = 'ms'

Note: ts_to_datetimestr parameter unit (from the above) supports "ms, ns,s, excel_date" formats. Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Step 4: Click execute button and execute the pipeline. Once the pipeline is executed, verify data from Alert_time column that shows human readable time string (as shown in the below screen shot).

Step 5: Verify the data (as shown in the below screenshot)

datetime - Convert Human readable Date & Timestamp to Milliseconds

Step 1: Create an empty pipeine datetime_to_milliseconds_example

Step 2: Add the following pipeline code/commands into the above created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates set of records (ipaddress, timestampin milliseconds,id) ##### using AIOps studio. ##### Using RDA functionality *dm:filter renamed two column names ##### ipaddress to IP_Address, timestamp to Timestamp_in_milliseconds ##### After renaming is completed, dm:function 'datetime' is used #### to convert timestamp in string format into timestamp in milliseconds @dm:empty --> @dm:addrow ipaddress = '10.10.1.1' & timestamp = '2021-01-15 03:00:00' & id = 'a1' --> @dm:addrow ipaddress = '10.10.1.2' & timestamp = '2021-01-15 04:00:00' & id = 'a2' --> @dm:addrow ipaddress = '10.10.1.3' & timestamp = '2021-01-15 05:00:00' & id = 'a3' --> @dm:addrow ipaddress = '10.10.1.4' & timestamp = '2021-01-15 06:00:00' & id = 'a4' --> *dm:filter * get id,ipaddress as 'IP_Address',timestamp as 'Timestamp_in_milliseconds' --> @dm:map attr = 'Timestamp_in_milliseconds' & func = 'datetime'

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Step 4: Click execute button and execute the pipeline. Once the pipeline is executed, verify data from Alert_time column that shows human readable time string (as shown in the below screen shot).

Step 5: Verify the data (as shown in the below screenshot)

Last updated