Google Analytics not working on OOD

We have Google analytics configured for OOD for centos 7, and it stopped working for the OOD on Centos 8 (No GA entries when someone is accessing the OOD website). We used the same OOD deployment procedure and configuration files, and we could not find which part went wrong.

I checked on the OOD server, the ood_portal.yml and ood-portal.conf file shows exactly as in 1. Adding Google Analytics — Open OnDemand 2.0.13 documentation
I also tried update_ood_portal, restarting httpd and htcacheclean, and the GA still not work.
The file /opt/ood/mod_ood_proxy/lib/analytics.lua exist with correct permission.
We have the following packages installed.
httpd-devel-2.4.37-21.module_el8.2.0+494+1df74eae.x86_64
httpd-tools-2.4.37-21.module_el8.2.0+494+1df74eae.x86_64
httpd-2.4.37-21.module_el8.2.0+494+1df74eae.x86_64
httpd-filesystem-2.4.37-21.module_el8.2.0+494+1df74eae.noarch

I worked with the Google Analytics team and confirmed that it can collect data on a test website.
So it is more likely the error is on the OOD part. I would like some help in debugging and find where it goes wrong.

Looks like we’re using wget to send off the data right the on the web node.

You can turn lua log level to debug and see what the response is. I’m guessing that you either have some connectivity issue or you simply don’t have wget.

I confirmed the wget works on the OOD server node.
How can I turn the lua log level to debug?
Thanks!

I set the lua to the debug level, and I can see some lua:debug entries on the httpd/error.log, the entries look like the following:

[Wed Dec 01 13:15:26.083613 2021] [lua:debug] [pid 440226:tid 140497867548416] lua_request.c(1860): [client 10.2.5.217:63303] AH01488: request_rec->dispatching unparsed_uri → string, referer: https://ridnc066is04.eth.rsiec.ind.science.roche.com/pun/sys/dashboard/assets/application-5a71c15dc32e52ce12816788532d4913b76b0ddb742b75f7c58bfce4e8555966.css
[Wed Dec 01 13:15:26.084238 2021] [lua:debug] [pid 440226:tid 140497867548416] lua_request.c(1842): [client 10.2.5.217:63303] AH01486: request_rec->dispatching subprocess_env → apr table, referer: https://ridnc066is04.eth.rsiec.ind.science.roche.com/pun/sys/dashboard/assets/application-5a71c15dc32e52ce12816788532d4913b76b0ddb742b75f7c58bfce4e8555966.css
[Wed Dec 01 13:15:26.084247 2021] [lua:debug] [pid 440226:tid 140497867548416] lua_request.c(1842): [client 10.2.5.217:63303] AH01486: request_rec->dispatching subprocess_env → apr table, referer: https://ridnc066is04.eth.rsiec.ind.science.roche.com/pun/sys/dashboard/assets/application-5a71c15dc32e52ce12816788532d4913b76b0ddb742b75f7c58bfce4e8555966.css

However, when I search for “Analytics input:” or “Analytics output” I could not find any. I am accessing the website at the meantime. Does this mean the Analytics.lua is not triggered at all?
Thanks!

In the error log, we also have entry that exist for a long time:

[Wed Dec 01 13:15:26.084263 2021] [lua:warn] [pid 440226:tid 140497867548416] AH01471: Lua error: /opt/ood/mod_ood_proxy/lib/logger.lua:22: bad argument #2 to ‘date’ (number has no integer representation)

Would this be the cause?

Could be. Did you add the analytics options to your ood_portal.yml?

Yes we already have the config exist:

ood config
[root@ridnc001is03]$ less /etc/ood/config/ood_portal.yml
analytics:
url: ‘http://www.google-analytics.com/collect
id: ‘UA-120795448-19’

which generate config in httpd
[root@ridnc001is03 conf.d]# less ood-portal.conf
<Location “/pun”>

SetEnv OOD_ANALYTICS_TRACKING_URL “http://www.google-analytics.com/collect
SetEnv OOD_ANALYTICS_TRACKING_ID “UA-120795448-19”
LuaHookLog analytics.lua analytics_handler

I tried with “/opt/ood/ood-portal-generator/sbin/update_ood_portal -f” and httpd restart as well.

I’m looking to release 2.0.20 today, it has a bugfix for the lua warning you’re seeing. But I feel like you’d see that on the other system? In any case - that may solve this though I’m skeptical.

Indeed - what’s changed here? The httpd version. Maybe the newer version really doesn’t like that warning?

what about the analytics lua part? Any suggestions to debug further?

When I turn this feature on with debug logs I saw this message. You should see something similar.

[Fri Dec 03 20:12:23.471769 2021] [lua:debug] [pid 40:tid 139666162448128] @/opt/ood/mod_ood_proxy/lib/analytics.lua(84): [client 10.0.2.100:36404] Analytics input: 'v=1&t=pageview&tid=UA-79331310-4&cid=jeff%40localhost&uid=jeff%40localhost&uip=10.0.2.100&a=Mozilla%2f5.0+%28X11%3b+Fedora%3b+Linux+x86_64%3b+rv%3a94.0%29+Gecko%2f20100101+Firefox%2f94.0&de=utf-8&ul=en-us&dh=localhost&dp=%2fpun%2fsys%2fdashboard&cd1=jeff&cd2=4d24589309d3ec64f1df084048eccae69967b98f&cd3=2021-12-03T20%3a12%3a23Z&cd4=jeff%40localhost&cd5=GET&cd6=200&cd7=http%3a%2f%2flocalhost%3a5556%2f&cm1=7797&cm2=0', referer: http://localhost:5556/
[Fri Dec 03 20:12:23.472138 2021] [lua:debug] [pid 40:tid 139666162448128] @/opt/ood/mod_ood_proxy/lib/analytics.lua(85): [client 10.0.2.100:36404] Analytics output: 'sh: wget: command not found' [23.178 ms], referer: http://localhost:5556/

I just grepped for it with grep 'analytics.lua' /var/log/httpd/localhost*. Do you see anything from a similar grep?