Skip to content

Commit b56bd8d

Browse files
authored
Merge pull request #26 from glickel/patch-1
Fix apache error log format
2 parents 6b06e4c + 4e59ad1 commit b56bd8d

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Diff for: flog_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ func ExampleNewLog() {
2727
// Output:
2828
// 222.83.191.222 - - [22/Apr/2018:09:30:00 +0000] "DELETE /innovate/next-generation HTTP/1.1" 406 7610
2929
// 144.199.149.125 - waelchi7603 [22/Apr/2018:09:30:00 +0000] "PUT /revolutionary HTTP/1.1" 301 8089 "https://www.futureaggregate.io/users" "Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5 rv:4.0; en-US) AppleWebKit/536.38.2 (KHTML, like Gecko) Version/6.0 Safari/536.38.2"
30-
// [Sun Apr 22 09:30:00 2018] [eaque:error] [pid 3748:tid 2783] [client: 54.26.161.221] We need to transmit the open-source JSON capacitor!
31-
// <15>Apr 22 09:30:00 parisian2785 eius[350]: You can't quantify the capacitor without connecting the virtual XSS transmitter!
32-
// <12>2 2018-04-22T09:30:00.000Z internalmagnetic.io necessitatibus 3954 ID418 - Try to navigate the AGP feed, maybe it will quantify the optical monitor!
33-
// 7.101.102.40 - dibbert8018 [22/Apr/2018:09:30:00 +0000] "PATCH /empower/leading-edge/markets/whiteboard HTTP/1.0" 502 21224
30+
// [Sun Apr 22 09:30:00 2018] [eaque:error] [pid 3748:tid 2783] [client 54.26.161.221:31944] Backing up the program won't do anything, we need to compress the optical PCI bandwidth!
31+
// <94>Apr 22 09:30:00 ortiz5384 vel[1775]: If we copy the firewall, we can get to the PCI firewall through the redundant SQL port!
32+
// <23>3 2018-04-22T09:30:00.000Z humaniterate.io iusto 544 ID177 - Use the optical RAM hard drive, then you can program the auxiliary feed!
33+
// 195.44.200.155 - kihn6187 [22/Apr/2018:09:30:00 +0000] "GET /revolutionary/e-markets/holistic/syndicate HTTP/2.0" 404 14503
3434
//
3535
}
3636

Diff for: log.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const (
1313
ApacheCommonLog = "%s - %s [%s] \"%s %s %s\" %d %d"
1414
// ApacheCombinedLog : {host} {user-identifier} {auth-user-id} [{datetime}] "{method} {request} {protocol}" {response-code} {bytes} "{referrer}" "{agent}"
1515
ApacheCombinedLog = "%s - %s [%s] \"%s %s %s\" %d %d \"%s\" \"%s\""
16-
// ApacheErrorLog : [{timestamp}] [{module}:{severity}] [pid {pid}:tid {thread-id}] [client: %{client}] %{message}
17-
ApacheErrorLog = "[%s] [%s:%s] [pid %d:tid %d] [client: %s] %s"
16+
// ApacheErrorLog : [{timestamp}] [{module}:{severity}] [pid {pid}:tid {thread-id}] [client %{client}:{port}] %{message}
17+
ApacheErrorLog = "[%s] [%s:%s] [pid %d:tid %d] [client %s:%d] %s"
1818
// RFC3164Log : <priority>{timestamp} {hostname} {application}[{pid}]: {message}
1919
RFC3164Log = "<%d>%s %s %s[%d]: %s"
2020
// RFC5424Log : <priority>{version} {iso-timestamp} {hostname} {application} {pid} {message-id} {structured-data} {message}
@@ -65,6 +65,7 @@ func NewApacheErrorLog(t time.Time) string {
6565
gofakeit.Number(1, 10000),
6666
gofakeit.Number(1, 10000),
6767
gofakeit.IPv4Address(),
68+
gofakeit.Number(1, 65535),
6869
gofakeit.HackerPhrase(),
6970
)
7071
}

Diff for: log_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func ExampleNewApacheErrorLog() {
4040

4141
created := time.Now()
4242
fmt.Println(NewApacheErrorLog(created))
43-
// Output: [Sun Apr 22 09:30:00 2018] [quia:crit] [pid 4214:tid 6037] [client: 90.151.9.107] If we back up the program, we can get to the SSL sensor through the redundant SAS program!
43+
// Output: [Sun Apr 22 09:30:00 2018] [quia:crit] [pid 4214:tid 6037] [client 90.151.9.107:14075] Copying the protocol won't do anything, we need to copy the redundant SAS program!
4444
}
4545

4646
func ExampleNewRFC3164Log() {

0 commit comments

Comments
 (0)