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

TT-12073 Tyk Splunk Pump Ignores Custom meta.fields Configuration, Always Returns Default Fields #803

Open
ebnou28 opened this issue Mar 13, 2024 · 0 comments

Comments

@ebnou28
Copy link

ebnou28 commented Mar 13, 2024

When configuring the Tyk Pump for Splunk with custom fields specified in the meta.fields section of pump.conf, the expected behavior is for these fields to populate the Splunk events. Cf this part of the code:

if len(p.config.Fields) > 0 {

However, despite correct configuration, Tyk Pump disregards these specifications and only sends the default set of fields.

My configuration setup:

I'm running this docker-compose with 3 services :

  • Tyk Pump version: latest
  • Tyk Gateway v2.9.2
  • Redis as the analytics storage
version: "3"

services:
  redis:
    image: redis:5-alpine
    ports:
      - 6379:6379
    networks:
    - tyk
  pump:
    image: tykio/tyk-pump-docker-pub:latest
    depends_on:
      - redis
    networks:
      - tyk
    volumes:
      - ./data/pump.conf:/opt/tyk-pump/pump.conf
    # env_file: ./pump.env
    environment:
      - TYK_PMP_PUMPS_SPLUNK_META_FIELDS=host
  tyk:
    image: tykio/tyk-gateway:v2.9.2
    depends_on:
      - redis
    networks:
      - tyk
    ports:
     - 8080:8080
    tty: true
    volumes:
      - ./tyk.standalone.conf:/opt/tyk-gateway/tyk.conf
      - ./apps:/opt/tyk-gateway/apps
    environment:
      - TYK_GW_ENABLEANALYTICS=true
      - TYK_GW_HEALTHCHECK_ENABLEHEALTHCHECKS=false
    command: tyk

networks:
  tyk:
    driver: bridge

Here is my Tyk pump.conf file (where I'm configuring the Splunk conf to send to a collector_url of an app running on my host machine on port 7000 :

{
    "analytics_storage_type": "redis",
    "analytics_storage_config": {
        "type": "redis",
        "host": "redis",
        "port": 6379,
        "hosts": null,
        "username": "",
        "password": "",
        "database": 0,
        "optimisation_max_idle": 100,
        "optimisation_max_active": 0,
        "enable_cluster": false
    },
    "purge_delay": 10,
  "pumps": {
      "splunk": {
        "type": "splunk",
        "meta": {
          "collector_token": "test",
          "collector_url": "http://host.docker.internal:7000/",
          "ssl_insecure_skip_verify": true,
          "obfuscate_api_keys": true,
          "obfuscate_api_keys_length": 10,
          "enable_batch":true,
          "max_retries": 2,
          "fields": [
            "method",
            "host",
            "path",
            "raw_path",
            "content_length",
            "user_agent",
            "response_code",
            "api_key",
            "time_stamp",
            "api_version",
            "api_name",
            "api_id",
            "org_id",
            "oauth_id",
            "raw_request",
            "request_time",
            "raw_response",
            "ip_address",
            "geo",
            "network",
            "latency",
            "tags",
            "alias",
            "track_path"
        ]
        }
      }
    },
    "dont_purge_uptime_data": true
}

Issue: even with fields explicitly set in the meta.fields field, I'm still receiving on the default list as in this else statement

} else {

ps: I'm receiving the collector token sent in the config, which makes me wonder whether the statement len(p.config.Fields) > 0 is true or not.


Currently, the only method I've found to successfully retrieve the desired fields involves enabling "enable_detailed_recording": true in the tyk.standalone.conf file (utilized for the Tyk Gateway). This approach provides me with the raw_request, which includes a significant amount of the targeted data.

Is my pump.conf configuration might be incorrect ? or is there an alternative method to get these fields without having to depend encoded raw_request?

I appreciate any insights.
Thanks

@caroltyk caroltyk changed the title Tyk Splunk Pump Ignores Custom meta.fields Configuration, Always Returns Default Fields TT-12073 Tyk Splunk Pump Ignores Custom meta.fields Configuration, Always Returns Default Fields May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants