Problem Description:


Enabling weekly log rotation schedule fails with the below ERROR


Request:
http://ip-10-45-32-38.ec2.internal:3011/api/v1/scheduler/submit/?
Response:
{
  "status" : 500,
  "errors" : [ "Cannot deserialize value of type `java.util.Date` from String \"05-03-2021\": expected format \"MM/dd/yyyy\"\n at [Source: (String)\"{\"schedule_status\":\"enabled\",\"starts_on\":\"05-03-2021\",\"time_hour\":\"10\",\"time_min\":\"10\",\"repeat_interval\":\"weekly\",\"repeat_every\":\"1\",\"repeat_on\":\"0\",\"ends\":\"never\",\"ends_on\":\"\",\"schedule_id\":\"084b4a94-e043-11e9-804d-0e31ddb79a3a\",\"command\":\"/opt/infoworks/bin/iw-logrotate.sh rotate\"}\"; line: 1, column: 42] (through reference chain: io.infoworks.platform.scheduler.core.model.ScheduleRequest[\"starts_on\"])" ]
}
Exception: 500 Server Error: Internal Server Error for url: http://ip-10-45-32-38.ec2.internal:3011/api/v1/scheduler/submit/
Logrotation enable failed



Root cause: This is a limitation with the weekly schedule in the log rotation utility which will be addressed in future releases.


Solution: Perform the below steps to resolve this issue.


a) cd /opt/infoworks/conf

b) vi  log-schedule.json



c) Look for the below starts_on value and change it.


Before Change:

"starts_on":"05-03-2021"


After Change:


"starts_on": "05/03/2021"


d) Save the file 

e) /opt/infoworks/bin/iw-logrotate.sh enable


Applicable Infoworks Versions:


v3.x,v4.x


More Details: Document for Enabling log rotation in IWX.


https://docs2x.infoworks.io/best-practices/best-practices/setting-log-rotation