Skip to content

Commit 10d9a93

Browse files
mu5h3rjordansissel
authored andcommitted
HTTPD24_ERRORLOG without tid and errorcode
Fixes #199
1 parent 6655856 commit 10d9a93

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

patterns/httpd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ HTTPD_COMBINEDLOG %{HTTPD_COMMONLOG} %{QS:referrer} %{QS:agent}
77

88
# Error logs
99
HTTPD20_ERRORLOG \[%{HTTPDERROR_DATE:timestamp}\] \[%{LOGLEVEL:loglevel}\] (?:\[client %{IPORHOST:clientip}\] ){0,1}%{GREEDYDATA:message}
10-
HTTPD24_ERRORLOG \[%{HTTPDERROR_DATE:timestamp}\] \[%{WORD:module}:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}:tid %{NUMBER:tid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_message}:)?( \[client %{IPORHOST:clientip}:%{POSINT:clientport}\])? %{DATA:errorcode}: %{GREEDYDATA:message}
10+
HTTPD24_ERRORLOG \[%{HTTPDERROR_DATE:timestamp}\] \[%{WORD:module}:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}(:tid %{NUMBER:tid})?\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_message}:)?( \[client %{IPORHOST:clientip}:%{POSINT:clientport}\])?( %{DATA:errorcode}:)? %{GREEDYDATA:message}
1111
HTTPD_ERRORLOG %{HTTPD20_ERRORLOG}|%{HTTPD24_ERRORLOG}
1212

1313
# Deprecated
1414
COMMONAPACHELOG %{HTTPD_COMMONLOG}
15-
COMBINEDAPACHELOG %{HTTPD_COMBINEDLOG}
15+
COMBINEDAPACHELOG %{HTTPD_COMBINEDLOG}

spec/patterns/httpd_spec.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@
7474
end
7575

7676
context "HTTPD_ERRORLOG", "matches a short httpd 2.4 message" do
77-
let(:value) {
77+
let(:value1) {
7878
"[Mon Aug 31 07:15:38.664897 2015] [proxy_fcgi:error] [pid 28786:tid 140169629898496] [client 81.139.1.34:52042] AH01071: Got error 'Primary script unknown\n'"
7979
}
8080
it "generates the fields" do
81-
expect(grok_match(subject, value)).to include(
81+
expect(grok_match(subject, value1)).to include(
8282
'timestamp' => 'Mon Aug 31 07:15:38.664897 2015',
8383
'module' => 'proxy_fcgi',
8484
'loglevel' => 'error',
@@ -87,7 +87,22 @@
8787
'clientip' => '81.139.1.34',
8888
'clientport' => '52042',
8989
'errorcode' => 'AH01071',
90-
'message' => [ value, "Got error 'Primary script unknown\n'" ]
90+
'message' => [ value1, "Got error 'Primary script unknown\n'" ]
91+
)
92+
end
93+
94+
let(:value2) {
95+
"[Thu Apr 27 10:39:46.719636 2017] [php7:notice] [pid 17] [client 10.255.0.3:49580] Test error log record"
96+
}
97+
it "generates the fields" do
98+
expect(grok_match(subject, value2)).to include(
99+
'timestamp' => 'Thu Apr 27 10:39:46.719636 2017',
100+
'module' => 'php7',
101+
'loglevel' => 'notice',
102+
'pid' => '17',
103+
'clientip' => '10.255.0.3',
104+
'clientport' => '49580',
105+
'message' => [ value2, "Test error log record" ]
91106
)
92107
end
93108
end
@@ -124,4 +139,5 @@
124139
end
125140
end
126141

142+
127143
end

0 commit comments

Comments
 (0)