Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reporters] File and TCP reporters - headers format feature not fully implemented #8226

Closed
kirestoj01 opened this issue Jul 28, 2022 · 1 comment

Comments

@kirestoj01
Copy link

💥 Describe the bug

When File reporter is set, you can not include/exclude/rename which elements of the headers element to be used in the report.

🌄 To Reproduce

Steps to reproduce the behaviour:

  1. Go to gravitee.yml file and set the configuration for file reporter:

with :

file:
  enabled: true 
  fileName: ${gravitee.home}/logs/%s-yyyy_mm_dd
  output: json 
  request: 
   exclude: 
     - '*'
   include: 
     - log.clientRequest.headers.host

we get on the request.json file :

{ 
    "log": { 
        "clientRequest": { 
            "headers": { 
                "Authorization": [ 
                    "Bearer 4cB6d108-1f5a-42c1-b6d1-081f5ab2c19b" 
                ], 
                "Content-Type": [ 
                    "application/json" 
                ], 
                "User-Agent": [ 
                    "PostmanRuntime/7.28.4" 
                ], 
                "Accept": [ 
                    "*/*" 
                ], 
                "Host": [ 
                    "localhost:8082" 
                ], 
                "Accept-Encoding": [ 
                    "gzip, deflate, br" 
                ], 
                "Connection": [ 
                    "keep-alive" 
                ], 
                "content-length": [ 
                    "54" 
                ], 
                "X-Gravitee-Transaction-Id": [ 
                    "ff46dbf9-f07f-435f-86db-f9f07f635fc5" 
                ], 
                "X-Gravitee-Request-Id": [ 
                    "ff46dbf9-f07f-435f-86db-f9f07f635fc5" 
                ] 
            } 
        } 
    } 
}

so all headers are included instead of only 'Host' header

With :

file:
    enabled: true # Is the reporter enabled or not (default to false)
    fileName: ${gravitee.home}/logs/%s-yyyy_mm_dd
    output: json # Can be csv, json, elasticsearch or message_pack
    request: # (Following mapping section is also available for other types: node, health-check, log)
     exclude: # Can be a wildcard (ie '*') to exclude all fields (supports json path)
       - log.clientRequest.headers.Host
#     include: # Only if exclude is used (supports json path)

request.json is empty;

With :

  
file:
    enabled: true # Is the reporter enabled or not (default to false)
    fileName: ${gravitee.home}/logs/%s-yyyy_mm_dd
    output: json # Can be csv, json, elasticsearch or message_pack
    request: # (Following mapping section is also available for other types: node, health-check, log)
     exclude: # Can be a wildcard (ie '*') to exclude all fields (supports json path)
       - log.clientRequest.headers.Host
     include: # Only if exclude is used (supports json path)
       - '*'

request.json will still contain 'host" header

    "log": { 
        "timestamp": 1658939532105, 
        "api": "863d0580-c24a-4746-bd05-80c24ae74661", 
        "requestId": "6dba5f76-fe4a-492d-ba5f-76fe4ae92d98", 
        "clientRequest": { 
            "method": "GET", 
            "headers": { 
                "Authorization": [ 
                    "Bearer 4cB6d108-1f5a-42c1-b6d1-081f5ab2c19b" 
                ], 
                "Content-Type": [ 
                    "application/json" 
                ], 
                "User-Agent": [ 
                    "PostmanRuntime/7.28.4" 
                ], 
                "Accept": [ 
                    "*/*" 
                ], 
                "Host": [ 
                    "localhost:8082" 
                ],

🌈 Expected behaviour

It is expected to include/remove/rename only the header that has been set in the configuration.

💻 Desktop:

Please complete the following information:

  • Environment: 3.10.1, 3.18.1
  • OS: [Docker Install]

⚠️ Potential impacts

Which other features may be impacted by this fix. This could be populated after fix

What are the impacted versions?

🔗 Dependencies

Link a story or other related things...

@gaetanmaisse
Copy link
Contributor

Tested on 3.18.x env, ✅
image

@phiz71 phiz71 changed the title [APIM] File reporter headers format feature not fully implemented [Reporters] File and TCP reporters - headers format feature not fully implemented Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
API Management
Awaiting triage
Development

No branches or pull requests

4 participants