Q:

logrotate dateformat does not support milliseconds extension

I am using logrotate.  It works fine with dateformat %s and generates files in somefile.log.1555267419.gz.  But I need to add the extension in milliseconds dateformat(somefile.log.1555267419789.gz).  
I checked the manpage and as far as I have understood, It says it does not support milliseconds specifier.  
Is there any way to add milliseconds in extension and still be able to rotate the old log files? 
/var/log/somelog/*.log {
   compress
   notifempty
   daily
   copytruncate
   size 15M
   dateext
   dateformat .%s
   rotate 20
}

A:

As you have already mentioned, the logrotate docs mention no support of milliseconds.  You can get the EPOCH time using %s, assuming the system clock is past Sept 9 2001. 

dateformat format_string
Specify the extension for dateext using the notation similar to strftime(3) function.  Only %Y %m %d and %s specifiers are allowed.  The default value is -%Y%m%d.  Note that also the character separating log name from the extension is part of the dateformat string.  The system clock must be set past Sep 9th 2001 for %s to work correctly.  Note that the datestamps generated by this format must be lexically sortable (i.e., first the year, then the month then the day.  e.g., 2001/12/01 is ok, but 01/12/2001 is not, since 01/11/2002 would sort lower while it is later).  This is because when using the rotate option, logrotate sorts all rotated filenames to find out which logfiles are older and should be removed. 

However, you could try to set EPOCH with millisecond granularity using logrotate scripts manually.  Here is an example where you call a custom script located at /my/script which takes the rotated filename as the parameter.  Using $1 in the prerotate/postrotate you get the absolute path of the file being rotated.  You also want to use the nosharedscripts config (which is set by default) to make sure the prerotate/postrotate scripts are run per log file matching your *.log pattern. 
/var/log/somelog/*.log {
   compress
   notifempty
   daily
   copytruncate
   size 15M
   dateext
   dateformat .%s
   rotate 20
   nosharedscripts
   postrotate
       /my/bash/script $1 > /dev/null
   endscript
}

In your custom script, you can then set milliseconds on the file name by renaming it.  One way to get the EPOCH with milliseconds on a Linux machine is to run date "+%s%3N".