Skip to content

Commit 251d0d7

Browse files
Add missing exclude_logs feature.
1 parent db394e0 commit 251d0d7

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

  • apps
  • transformation_test/testdata/logging_processor-iis_access

apps/iis.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@ func (p LoggingProcessorMacroIisAccess) Expand(ctx context.Context) []confgenera
290290
// Handle field concatenation (serverIp+port, requestUrl)
291291
concatFields := IISConcatFields{}
292292

293+
// This is used to exclude the header lines above the logs
294+
// EXAMPLE LINES:
295+
// #Software: Microsoft Internet Information Services 10.0
296+
// #Version: 1.0
297+
// #Date: 2022-04-11 12:53:50
298+
excludeLogs := confgenerator.LoggingProcessorExcludeLogs{
299+
MatchAny: []string{`jsonPayload.message=~"^#(?:Fields|Date|Version|Software):"`},
300+
}
301+
293302
// Create fields map for simple field operations and moves
294303
fields := map[string]*confgenerator.ModifyField{
295304
InstrumentationSourceLabel: instrumentationSourceValue(p.Type()),
@@ -317,6 +326,7 @@ func (p LoggingProcessorMacroIisAccess) Expand(ctx context.Context) []confgenera
317326
return []confgenerator.InternalLoggingProcessor{
318327
parseRegex,
319328
concatFields,
329+
excludeLogs,
320330
modifyFields,
321331
}
322332
}

transformation_test/testdata/logging_processor-iis_access/input.log

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#Software: Microsoft Internet Information Services 10.0
2+
#Version: 1.0
3+
#Date: 2022-04-11 12:53:50
14
2022-03-10 17:26:30 ::1 GET /iisstart.png - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko http://localhost/ 200 0 0 18
25
2022-03-10 17:26:30 ::1 GET / - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 200 0 0 352
36
2022-03-10 17:26:32 ::1 GET /favicon.ico - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 0 2 49

0 commit comments

Comments
 (0)