Dear Team, For me logs are not generating at /var/log/ or /var/log/upstart after the installation I tried to modify few conf in tyk.conf but still not working Please suggest how to get logs configured.
git clone GitHub - TykTechnologies/tyk-ansible
cd tyk-ansible
sh scripts/init.sh
ansible-playbook playbook.yaml -t tyk-ce -t redis
as I was getting mongo db error So removed mongo db section from playbook.yaml as suggested by tyk community earlier.
Hi,
If you’re not using Tyk Pro, you don’t need mongodb so removing that is safe in that case.
Tyk sends logs to stderr and stdout and depends on the startup process to redirect those to log files.
Most modern Linux use systemd so logs can be seen with journalctl
but can also be redirected to a file using the StandardOutput=
and StandardError=
options. Documentation here
Cheers,
Pete
But I dont see any log file at /var/log
[root@ip-10-10-31-38 dev]# cd /var/log
[root@ip-10-10-31-38 log]# ls
anaconda btmp-20211001 cloud-init-output.log dmesg maillog messages-20210926 rhsm spooler tuned
audit choose_repo.log cron dmesg.old maillog-20210926 messages-20211003 secure spooler-20210926 wtmp
boot.log chrony cron-20210926 grubby_prune_debug maillog-20211003 ppp secure-20210926 spooler-20211003 yum.log
btmp cloud-init.log cron-20211003 lastlog messages redis secure-20211003 tallylog
Please suggest further
Hi,
Could you try the journalctl
command please?
For example
journalctl -u tyk-gateway
If that command doesn’t work please upload the results and the output of this command as well please
systemctl status tyk-gateway
Command (journalctl -u tyk-gateway) is showing below out which seems the tyk start log (same kind of logs comes to the console when we run ./tyk), doesn’t looks like api logs:
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg="–> Listening on port: 8080" prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg="–> PID: 427" prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg="Starting gateway rate limiter notifications…
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Loading policies” prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Policies found (1 total):” prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg="Loading API Specification from /opt/tyk-gatew
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg="Loading API Specification from /opt/tyk-gatew
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Detected 2 APIs” prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Loading API configurations.” prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Tracking hostname” api_name=cloudgatewayhttps
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Tracking hostname” api_name=“Tyk Test API” do
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Initialising Tyk REST API Endpoints” prefix=m
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“API bind on custom port:0” prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Initializing HealthChecker”
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Checking security policy: Open” api_id=cloudg
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“API Loaded” api_id=cloudgatewayhttps api_name
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“API bind on custom port:0” prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Initializing HealthChecker”
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Checking security policy: Token” api_id=1 api
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“API Loaded” api_id=1 api_name=“Tyk Test API”
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Loading uptime tests…” prefix=host-check-mg
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“Initialised API Definitions” prefix=main
Oct 07 21:58:11 ip-10-10-31-38.ap-southeast-1.compute.internal tyk[427]: time=“Oct 07 21:58:11” level=info msg=“API reload complete” prefix=main
Additionally I would like to know when we install tyk gateway open source then what all components get installed at /opt folder and If I want to unstall tyk gateway how I can proceed.
Hi,
The logs you are seeing are the gateway logs. You can set the log_level to increase and decrease the amount of messages given.
API analytics data is stored in redis. There is another open source product called tyk pump which can be used to extract that data and push it to a number of destinations including csv files, Prometheus, splunk, mongodb etc.
If enable_detailed_recording
is set in tyk.conf then detailed analytics will be saved to redis for all API calls. This puts significant load onto redis for busy sites so should be used with care. Alternatively it is also possible to enable enable_detailed_recording
for only individual APIs by setting "enable_detailed_recording": true
in an API definition
To uninstall the gateway you would do the reverse of the installation process. You seem to be using an RPM based distribution so I would expect the uninstall to be yum erase tyk-gateway
Cheers,
Pete