After the service is up and running, we will often use Application Logging Service to check the CAP application logs and check the CPU usage rate and memory usage rate. Customers often ask us to report the operating status regularly. (Bothersome)
Application Logging Service is only saved for 7 days, and checking it every day is a pain.
It’s a pain to check it every day, and I often forget about it, so I created a tool that automatically captures and saves the memory changes of the Application Logging Service.
By using this tool, you can capture and save the memory history of your CAP application at a fixed time every day.
The created tool has been uploaded to GitHub.
https://github.com/unosistema/SAPBTPLoggingCapture
Puppeteer is a library that allows you to run Chrome without displaying a screen from Node.js.
You can scrape, type on the screen, press buttons, and take screenshots while running Chrome without a screen.
If you are interested, please search for “headless browser”.
Let’s create a snapshot URL with Application Logging Service.
Access the Application Logging Service.
This time, we want to see the memory usage graph, so we’ll switch the graph to display.
A graph of CPU and memory trends was displayed.
Change the conditions so that we can check the changes over the past 24 hours.
A snapshot URL like the one below will be generated.
https://logs.cf.eu10-004.hana.ondemand.com/goto/(32 digit hash value)
We can check the memory usage for the past 24 hours just by accessing this snapshot URL directly.
Also, although I did not set a filter this time, the snapshot URL also remembers the filter settings.
Snapshot URL is very useful !!
However, I created a tool for people who find it troublesome/forgetful just to open their browser every day.
https://github.com/unosistema/SAPBTPLoggingCapture
Please clone the program from the GitHub repository above and rewrite some of the programs.
Please rewrite the three variables in app.js
// Change here!!
const btp_application_logging_snapshot_url = "xxxxxxxxxxxxxxxxxxxxxxx"; // ex. https://logs.cf.eu10-004.hana.ondemand.com/goto/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const sap_username = "[email protected]"; // Your SAP UniversalID(e-mail)
const sap_password = "xxxxxxxxxxxx"; // Your SAP UniversalID Password
Open a command prompt or terminal, move to the program directory, and install the library using the command below.
npm install
Run the program using the following command from the command prompt or terminal.
node app.js
Wait about a minute and a screenshot will be generated.
When you open the PNG file, you will see a screenshot of the graph for the past 24 hours.
Scheduling this program to run at regular intervals will definitely make operation and maintenance easier.
Just paste the captcha in the report materials to the customer.
In addition to Application Logging Service, it seems to have many uses, such as periodically taking screenshots of the HANA Cloud monitoring screen.