Syslog Server IP Address Update

Fezzik
Conversationalist

Syslog Server IP Address Update

I need to update the IP address of the syslog servers in approx 300 sites. Everything I have tried so far has been unsuccessful.  

 

I've tried using Python: 

 

 

 

 

import meraki

API_KEY = 'xxxxxxxxxx'

dashboard = meraki.DashboardAPI(API_KEY)

network_id = ['NID1', 'NID2', ....]

for network in  network_id:
        servers = [{'host': '10.46.99.2', 'port': 514, 'roles': ['Wireless event log', 'URLs', 'Flow', 'Security events', 'Appliance event log']}]
        response = dashboard.syslog_servers.updateNetworkSyslogServers(
        network_id, servers
)

print(response)

 

But I get this error: 

  File "syslogUpdater.py", line 14, in <module>
    response = dashboard.syslog_servers.updateNetworkSyslogServers(
AttributeError: 'DashboardAPI' object has no attribute 'syslog_servers'

 

Also tried using curl: 

#!/bin/sh -x

for i in `cat networkIds.txt`; do

curl -L --request PUT \
--url https://api.meraki.com/api/v0/networks/${i}/syslogServers \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Cisco-Meraki-API-Key: xxxxxxxxxxxxxxxx' \
--data '{
    "servers": [
        {
            "host": "10.46.99.21",
            "port": 514,
            "roles": [
                "Wireless event log",
                "URLs",
                "Flow",
                "Security events",
                "Appliance event log"
            ]
        }
    ]
}'
done

 

But I get this error: 

 

curl: (3) URL using bad/illegal format or missing URL
1 Reply 1
Edgar-VO
Building a reputation

Hi,

Try this

(Change your log servers parameters ofcourse)

 

 

import meraki
 
API_KEY = 'xxxxxxxxxx'
 
dashboard = meraki.DashboardAPI(API_KEY)
 
network_id = ['NID1', 'NID2', ....]
 
def Set_Syslog_Servers(def_network) :
 
    my_syslog = eval("[{'host': '10.111.30.4', 'port': '514', 'roles': ['Security events', 'Appliance event log', 'Switch event log', 'Wireless event log']}]")
 
    response = dashboard.networks.updateNetworkSyslogServers(def_network,my_syslog)
 
 
for network in  network_id:
  Set_Syslog_Servers(network)
print(response)
 
 
Get notified when there are additional replies to this discussion.