Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.

Commit 6868bff

Browse files
committed
Add logging write example
1 parent 6af45df commit 6868bff

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

examples/logging_write.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""Logging Service example using write."""
5+
6+
import os
7+
import sys
8+
9+
curpath = os.path.dirname(os.path.abspath(__file__))
10+
sys.path[:0] = [os.path.join(curpath, os.pardir)]
11+
12+
from pancloud import LoggingService
13+
from pancloud import Credentials
14+
15+
16+
VENDOR_ID = 'panw'
17+
LOG_TYPE = 'threat'
18+
19+
url = 'https://apigw-stg4.us.paloaltonetworks.com'
20+
21+
c = Credentials()
22+
23+
# Create Logging Service instance
24+
ls = LoggingService(
25+
url=url,
26+
credentials=c
27+
)
28+
29+
data = [
30+
{
31+
'generatedTime': 0,
32+
'uuid': 1,
33+
'user': 'acme/wcoyote',
34+
'action': 'drop',
35+
'type': 'vulnerability',
36+
'subType': 'brute-force',
37+
'name': 'anvil',
38+
'repeatCnt': 5
39+
}
40+
]
41+
42+
q = ls.write(vendor_id=VENDOR_ID, log_type=LOG_TYPE, data=data)
43+
44+
print(
45+
"\nWRITE: {}\n".format(q.text)
46+
)

0 commit comments

Comments
 (0)