[RESOLVED] Package installation logs

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Emeric
Messages: 4
Registration: December 2, 2024 - 4:29 PM

December 2, 2024 - 4:38 PM

Hello,

I would like to retrieve the logs from the "Installation Logs for package ***" to more easily audit my infrastructure. The goal is to create a CSV file named "Machine;Installation Logs for package ***".

I have tried to perform this operation via a query in the reporting system as well as through the API, but I haven't found a solution.

I am currently using Enterprise version 2.2.0.11720.

Thank you in advance for your help.
Attachments
logs.png
logs.png (2.57 KB) Viewed 5181 times
jarnaud
Messages: 16
Registration: May 3, 2024 - 3:37 p.m.

December 2, 2024 - 5:27 PM

Good morning,

I can offer you this:

Code: Select all

SELECT
    h.computer_name AS Machine,
    h.computer_fqdn AS FQDN,
    p.name AS Package_Name,
    p.install_status AS Installation_Status,
    p.install_date AS Installation_Date,
    p.install_output AS Installation_Logs
FROM
    hostpackagesstatus p
JOIN
    hosts h
ON
    p.host_id = h.uuid
WHERE
    p.install_status IS NOT NULL
ORDER BY
    h.computer_name, p.install_date;
Would that suit you?

Yours sincerely
Emeric
Messages: 4
Registration: December 2, 2024 - 4:29 PM

December 3, 2024 - 9:17 AM

Hello Jarnaud,

Great, that's perfect! 🙂

Is it possible to retrieve this request via the API? (I haven't seen this feature).

Something like this: https://wapt.myserveur.local/api/v3/reporting?id=3
Attachments
api.png
api.png (8.46 KB) Viewed 5143 times
jarnaud
Messages: 16
Registration: May 3, 2024 - 3:37 p.m.

December 3, 2024 - 10:44 AM

Hello Emeric,

Of course, it's possible.
https://www.wapt.fr/fr/doc/wapt-api.htm ... rting-exec

Code: Select all

import os
import json
import logging
import waptlicences
import requests
import sys
sys.path.append('/opt/wapt')
from common import get_requests_client_cert_session
from common import Wapt



WAPT = Wapt()
ini_wapt_path = WAPT.config_filename
w = Wapt(config_filename=ini_wapt_path)

# WAPT Conf
wapt_url = w.waptserver.server_url

user = "reporting"
password = "password"


def run_report():

    t = waptlicences.waptserver_login(ini_wapt_path,user,password)
    session = get_requests_client_cert_session(wapt_url,
    cert=(t['client_certificate'],t['client_private_key'],t['client_private_key_password']),
    verify=w.waptserver.verify_cert
    )
    session.cookies.set(t['session_cookies'][0]['Name'], t['session_cookies'][0]['Value'], domain=t['session_cookies'][0]['Domain'])
    t= None


    url = f'{wapt_url}/api/v3/reporting_exec?id=19'
    response = session.get(url)
    data = response.json()

    return data['result']



print(run_report())

I'll let you customize the username and password of a WAPT server user.
And you need to replace 2 with your SQL query number (you can see the SQL query IDs in the reporting tab in the left panel), for example:

Code: Select all

url = f'{wapt_url}/api/v3/reporting_exec?id=2
Best regards
Emeric
Messages: 4
Registration: December 2, 2024 - 4:29 PM

December 3, 2024 - 11:10

Thank you very much, everything is fine, I'm closing this ticket ;)
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

December 3, 2024 - 11:50 AM

Hello Emeric,

regarding your WAPT version, version 2.2 is no longer supported and it would be best to upgrade to 2.5 or even 2.6. :-)

Regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked