ext status changing logs

aminbaik88

Bronze Partner
Joined
Sep 19, 2023
Messages
34
Reaction score
2
Hello,
is there any way to save the 3CX management log on any kind of database instead of download it through the support logs ?
the main aim is to get the ext status change time logs for each ext.
any kind of idea to do that?
thanks.
 
Hi, you can get the Audit Log as a CSV - it is not part of the Data Connector exports.
 
any other way to read it througe api or any external tools
any way to send the audit log to syslog server ?
thanks.
 
Hello aminbaik88,

you could use the 3CX config API to get the Audit log.

3CX Rest-API (config):
https://www.3cx.com/docs/configuration-rest-api

Check the swagger list of functions:
{{baseUrl}}/xapi/v1 -> {"name":"ReportAuditLog","kind":"EntitySet","url":"ReportAuditLog"}

API function to get Audit log:
{{baseUrl}}/xapi/v1/ReportAuditLog/Pbx.DownloadAuditLog(clientTimeZone={{clientTimeZone}})?$top=<integer>&$skip=<integer>&$search=<string>&$filter=<string>&$count=<boolean>&$select=<string>,<string>&$orderby=<string>,<string>&$expand=<string>,<string>

Paulo
 
thanks for your answe.
can help me with a real example of the function
how the audit log data retention ?
thanks.
 
Hello @aminbaik88 ,

I have quickly setup an API script in Python, to receive the Audit Log.
First change the login details, then run the script.

Python:
import requests
import json

# Fill these 3 lines with real information
serverFQDN = "{fqdn}:{port}"
userName = "{username}"
passWord = "{password}"


# Authenticate on 3CX server with Username and Password to get an Access Token
# POST /webclient/api/Login/GetAccessToken
url = "https://" + serverFQDN + "/webclient/api/Login/GetAccessToken"
headers = {"Content-Type": "application/json; charset=utf-8"}
data = {"SecurityCode":"", "Username":userName, "Password":passWord}
response = requests.post(url, headers=headers, json=data)
access_token = response.json() ['Token']['access_token']
#print ("access_token ", access_token)
# Nah, it's all good


# Get Audit Log information
# GET /xapi/v1/ReportAuditLog/Pbx.GetAuditLogData()
url = "https://" + serverFQDN + "/xapi/v1/ReportAuditLog/Pbx.GetAuditLogData()"
headers = {"Content-Type": "application/json; charset=utf-8", 'Authorization': 'Bearer ' + access_token}
data = {
"$top": 1,
"$skip": 0,
"$search": "",
"$filter": "",
"$count": 1,
"$select": ",",
"$orderby": ",",
"$expand": ","
}
# Here we go...
response = requests.get(url, headers=headers, json=data)
print (response.json())
# Okay, it's done!

This may not be perfect, but it will get you started right away.

Paulo
 
how the audit log data retention ?
 
I mean the data time keeping
for example last 1week daily etc...
 
There's no status change log in the audit log...

Not sure why it's even suggested here.
 
Hello aminbaik88,

Where i did not get the question, is that you have posted the questions:
"is there any way to save the 3CX management log"
And the question "any other way to read it througe api "

Where is seems to me, that if you DOWNLOAD/GET the data, the retention is in your own hands.
Keep, filter, delete as you like
Please note that the API has filter options.
If you would like to ONLY have 2 weeks, than filter the result.

Or again, I do not uderstand what you want to achieve.

Paulo
 
Hello aminbaik88,

Where i did not get the question, is that you have posted the questions:
"is there any way to save the 3CX management log"
And the question "any other way to read it througe api "

Where is seems to me, that if you DOWNLOAD/GET the data, the retention is in your own hands.
Keep, filter, delete as you like
Please note that the API has filter options.
If you would like to ONLY have 2 weeks, than filter the result.

Or again, I do not uderstand what you want to achieve.

Paulo
i mean how many days the audit log will keep
 
There's no status change log in the audit log...

Not sure why it's even suggested here.
do you any way to do that? or its not possible at all?
 
Hello aminbaik88,

are you looking for this information ?

1757505265307.png

Paulo