Skip to content

Commit

Permalink
Need two digits for dates in the common Apache log format in the Gatl…
Browse files Browse the repository at this point in the history
…ing performance tests. Formatting fixes. (opensearch-project#3318)

Signed-off-by: David Venable <[email protected]>
  • Loading branch information
dlvenable authored and asifsmohammed committed Sep 27, 2023
1 parent 96060aa commit eeaabbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import java.util.function.Function;

public final class Templates {
public static final String APACHE_COMMON_LOG_DATETIME_PATTERN = "d/LLL/uuuu:HH:mm:ss";
public static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(APACHE_COMMON_LOG_DATETIME_PATTERN);
private static final String APACHE_COMMON_LOG_DATETIME_PATTERN = "dd/LLL/uuuu:HH:mm:ss";
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(APACHE_COMMON_LOG_DATETIME_PATTERN);

public static String now() {
return formatter.format(LocalDateTime.now()) + " -0700";
return FORMATTER.format(LocalDateTime.now()) + " -0700";
}

public static Function<Session, String> apacheCommonLogTemplate(final int batchSize) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
{
"log": "127.0.0.1 - frank [7/Dec/2021:10:00:00 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326"
"log": "127.0.0.1 - frank [17/Dec/2021:10:00:00 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326"
}
]

0 comments on commit eeaabbf

Please sign in to comment.