Specify the log type with additional optional parameters to retrieve logs from a firewall.
The type of logs to retrieve:
—URL filtering logs
—Data filtering logs
—Correlated event logs as seen in the user interface within
Automated Correlated Engine
—Correlated event details as seen in the user interface when you select an event within
Automated Correlated Engine
—Correlated events by category, currently compromised hosts seen within
(Optional) Specify the match criteria for the logs. This is similar to the query provided in the web interface under the
tab when viewing the logs. The query must be URL encoded.
(Optional) Specify the number of logs to retrieve. The default is 20 when the parameter is not specified. The maximum is 5000.
(Optional) Specify the number of logs to skip when doing a log retrieval. The default is 0. This is useful when retrieving logs in batches where you can skip the previously retrieved logs.
(Optional) Specify whether logs are shown oldest first (
) or newest first (
). Default is
(Optional) Log data sizes can be large so the API uses an asynchronous job scheduling approach to retrieve log data. The initial query returns a Job ID (
) that you can then use for future queries with the
—Check status of an active job or retrieve the log data when the status is
(finished). This is slightly different than the asynchronous approach to retrieve tech support data where a separate status action is available.
—Stop an active job.
—When not specified, such as during an initial query, the system creates a new job to retrieve log data.
Learn more about
Asynchronous and Synchronous Requests to the PAN-OS XML API.
Example: Use the API to Retrieve Traffic Logs
Use the API to Retrieve Traffic Logs
Create a job to retrieve all traffic logs that occurred after a certain time:
https://firewall/api/?type=log&log-type=traffic&query=(receive_time geq '2012/06/22 08:00:00')
A web-browser will automatically URL encode the parameters, but when using cURL, the query parameter must be URL encoded.
<response status="success" code="19">
<line>query job enqueued with jobid 18</line>
Retrieve traffic log data using the following request using the job ID as the value returned in the previous response:
Confirm that the XML response looks similar to the following:
<logs count="20" progress="100n>
<entry logid="5753304543500710425"> <domain>1</domain> <receive_time>2012/06/13 15:43:17</receive_time> <serial>001606000117</serial> <segno>6784588</segno> <actionflags>0x0</actionflags> <type>TRAFFIC</type> <subtype>start</subtype> <config_ver>1</config_ver> <time_generated>2012/06/13 15:43:17</time_generated> <src>172.16.1.2</src> <dst>10.0.0.246</dst> <natsrc>10.16.0.96</natsrc> <natdst>10.0.0.246</natdst> <rule>default allow</rule>
When the job status is FIN (finished), the response automatically includes all the logs in the XML data response. The
node in XML is not present when the job status is still pending. After successful log data retrieval, the system automatically deletes the job.
(Optional) Delete and active log retrieval job.To delete an active log retrieval job, run the following query:
A successful completion returns a job ID.