FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sumologic-python-sdk/scripts/bulk-set.py at main · SumoLogic/sumologic-python-sdk · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
SumoLogic
/
sumologic-python-sdk
Public
Notifications
You must be signed in to change notification settings
Fork
77
Star
90
Code
Issues
12
Pull requests
12
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sumologic-python-sdk
/
scripts
/
bulk-set.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (37 loc) · 1.42 KB
Breadcrumbs
sumologic-python-sdk
/
scripts
/
bulk-set.py
Copy path
File metadata and controls
41 lines (37 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Sets an attribute across all collectors and sources in a given account.
#
# python bulk-set.py <accessId> <accessKey> <attribute> <value>
import
pprint
import
sys
import
time
from
sumologic
import
SumoLogic
args
=
sys
.
argv
sumo
=
SumoLogic
(
args
[
1
],
args
[
2
])
delay
=
.25
time
.
sleep
(
delay
)
attr
,
val
=
args
[
3
],
args
[
4
]
cs
=
sumo
.
collectors
()
time
.
sleep
(
delay
)
f
=
[{
u'regexp'
:
u'
\\
d{1,3}
\\
.
\\
d{1,3}
\\
.
\\
d{1,3}
\\
.(
\\
d{1,3})'
,
u'mask'
:
u'255'
,
u'filterType'
:
u'Mask'
,
u'name'
:
u'last octet mask'
}]
for
c
in
cs
:
if
'category'
not
in
c
or
'bwe'
not
in
c
[
'category'
]
and
'bwm'
not
in
c
[
'category'
]:
print
(
'collector: '
+
c
[
'name'
])
ss
=
sumo
.
sources
(
c
[
'id'
])
time
.
sleep
(
delay
)
for
s
in
ss
:
sv
,
etag
=
sumo
.
source
(
c
[
'id'
],
s
[
'id'
])
time
.
sleep
(
delay
)
svi
=
sv
[
'source'
]
if
'category'
not
in
svi
or
'bwe'
not
in
svi
[
'category'
]
and
'bwm'
not
in
svi
[
'category'
]:
print
(
'source: '
+
svi
[
'name'
])
svi
[
'filters'
]
=
f
r
=
sumo
.
update_source
(
c
[
'id'
],
sv
,
etag
)
print
(
r
)
print
(
r
.
text
)
time
.
sleep
(
delay
)
#if svi['forceTimeZone'] == False:
# svi['forceTimeZone'] = True
# svi[u'timeZone'] = u'UTC'
# r = sumo.update_source(c['id'], sv, etag)
# print(str(r) + ': ' + str(r.text))
# time.sleep(delay)
Back
|
FazBrowse Home
|
New Git URL