Not able to see the response code in the tyk logs

We are using syslog for the same.
Have installed tyk-pump, redis and gateway
pump.conf

{
“analytics_storage_type”: “redis”,
“analytics_storage_config”: {
“type”: “redis”,
“host”: “localhost”,
“port”: 6379,
“hosts”: null,
“username”: “”,
“password”: “”,
“database”: 0,
“optimisation_max_idle”: 100,
“optimisation_max_active”: 0,
“enable_cluster”: false
},
“purge_delay”: 10,
“pumps”: {
“mongo”: {
“type”: “mongo”,
“meta”: {
“collection_name”: “tyk_analytics”,
“mongo_url”: “mongodb://localhost/tyk_analytics”,
“collection_cap_max_size_bytes”: 1048576,
“collection_cap_enable”: true
}
},
“kafka”: {
“type”: “kafka”,
“meta”: {
“broker”: [
“localhost:9092”
],
“client_id”: “tyk-pump”,
“topic”: “tyk-pump”,
“timeout”: 10,
“compressed”: true,
“meta_data”: {
“key”: “value”
}
}
},
“syslog”: {
“name”: “syslog”,
“meta”: {
“transport”: “udp”,
“network_addr”: “localhost:5140”,
“log_level”: 6,
“tag”:“syslog-pump”
}
},
“prometheus”: {
“type”: “prometheus”,
“meta”: {
“path”: “/metrics”,
“listen_address”: “:9090”
}
},
“dogstatsd”: {
“type”: “dogstatsd”,
“meta”: {
“address”: “localhost:8125”,
“namespace”: “pump”,
“async_uds”: true,
“async_uds_write_timeout_seconds”: 2,
“buffered”: true,
“buffered_max_messages”: 32
}
}
},
“uptime_pump_config”: {
“collection_name”: “tyk_uptime_analytics”,
“mongo_url”: “mongodb://localhost/tyk_analytics”,
“collection_cap_max_size_bytes”: 1048576,
“collection_cap_enable”: true
},
“dont_purge_uptime_data”: false
}
tyk-gateway.conf
{
“listen_address”: “”,
“listen_port”: 8080,
“secret”: “352d20ee67be67f6340b4c0605b044b7”,
“template_path”: “/opt/tyk-gateway/templates”,
“use_db_app_configs”: false,
“app_path”: “/opt/tyk-gateway/apps”,
“middleware_path”: “/opt/tyk-gateway/middleware”,
“storage”: {
“type”: “redis”,
“host”: “localhost”,
“port”: 6379,
“username”: “”,
“password”: “”,
“database”: 0,
“optimisation_max_idle”: 2000,
“optimisation_max_active”: 4000
},
“enable_analytics”: true,
“analytics_config”: {
“enable_detailed_recording”: true,
“type”: “”,
“ignored_ips”:
},
“dns_cache”: {
“enabled”: false,
“ttl”: 3600,
“check_interval”: 60
},
“allow_master_keys”: false,
“policies”: {
“policy_source”: “file”
},
“hash_keys”: true,
“suppress_redis_signal_reload”: false,
“force_global_session_lifetime”: false,
“max_idle_connections_per_host”: 500
}

Can you confirm if you mean gateway logs or via the analytics? It is worth mentioning that the response codes are not logged in the gateway logs.

1 Like

Either from gateway logs or from analytics ??
What will u suggest ??
if no then how can it be achieved??

Hello @Swapnil_Chitte your setup seems to be correct. And you are using syslog as an analytics pump. Can you please show us what you see in syslog. According to the syslog pump code you should see the status under response_code.

This is just a single api related logs.
Jan 25 05:36:49 TYKPUMP tyk[10288]: time=“Jan 25 05:36:49” level=info msg=“Checking security policy: Open” api_id=6c0b01af-29a7-43ca-a578-2cfb11887bdc api_name=boxer org_id=1
Jan 25 05:36:49 TYKPUMP tyk[10288]: time=“Jan 25 05:36:49” level=info msg=“API Loaded” api_id=6c0b01af-29a7-43ca-a578-2cfb11887bdc api_name=boxer org_id=1 prefix=gateway server_name=-- user_id=-- user_ip=–

Hi @Swapnil_Chitte, I advise you remove the any pump configs you are not using. Especially the one for mongoDB as it may block the logs from pumping. Also try setting “dont_purge_uptime_data”: true.

Finally crosscheck the port your syslog is running on (with this command sudo netstat -lptuna | grep syslog) and confirm if your pump config is correct.

Let us know it goes

1 Like

Hi @Olu ,
I have done the changes as per your suggestion .


Do I need to use FluentD for the same ?

I think you could use FluentD as mentioned by the docs but I used RSC Remote Syslog on the Linux system I tested it on.

As for the command you shared, can you confirm that syslog is listening on 5140. The grep syslog would show you the port.