filmov
tv
Python Network Automation: Enable Logging for Cisco CLI Command Parser and store output in Log File
![preview_player](https://i.ytimg.com/vi/GPB27_gckkI/maxresdefault.jpg)
ะะพะบะฐะทะฐัั ะพะฟะธัะฐะฝะธะต
#networkautomation #pythonautomation #ciscopython
๐๐ผ๐ฟ ๐๐ผ๐บ๐ฝ๐น๐ฒ๐๐ฒ ๐ฃ๐๐๐ต๐ผ๐ป ๐ณ๐ผ๐ฟ ๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ๐ ๐ง๐๐๐ผ๐ฟ๐ถ๐ฎ๐น๐:
๐๐ป๐ฟ๐ผ๐น๐น ๐ถ๐ป ๐๐ต๐ฒ ๐ฏ๐ฒ๐น๐ผ๐ ๐จ๐ฑ๐ฒ๐บ๐ ๐๐ผ๐๐ฟ๐๐ฒ:
๐ฃ๐น๐ฎ๐๐น๐ถ๐๐: ๐ฃ๐๐๐ต๐ผ๐ป ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด ๐ณ๐ผ๐ฟ ๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ๐(๐ญ๐ฎ๐ฌ+ ๐ฉ๐ถ๐ฑ๐ฒ๐ผ๐)
โธ๐ฃ๐น๐ฒ๐ฎ๐๐ฒ ๐ณ๐ผ๐น๐น๐ผ๐ ๐ฏ๐ฒ๐น๐ผ๐ ๐๐ถ๐๐๐๐ฏ ๐ฃ๐ฎ๐ด๐ฒ ๐ณ๐ผ๐ฟ ๐๐ต๐ฒ ๐น๐ฎ๐๐ฒ๐๐ ๐ฐ๐ผ๐ฑ๐ฒ๐:
๐ฃ๐น๐ฎ๐๐น๐ถ๐๐: ๐๐ถ๐๐ฐ๐ผ ๐ก๐ซ๐๐ฃ๐-๐๐๐ ๐ฃ๐๐๐ต๐ผ๐ป ๐๐๐๐ผ๐บ๐ฎ๐๐ถ๐ผ๐ป: ๐ก๐ฒ๐ ๐๐ ๐ต๐ธ :๐ฃ๐ฎ๐ฟ๐๐ฒ ๐ท๐๐ผ๐ป ๐ซ๐ ๐ ๐๐ผ๐ป๐ณ๐ถ๐ด๐๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐๐ฎ๐๐ฎ
๐ฃ๐น๐ฎ๐๐น๐ถ๐๐: ๐๐ฒ๐ฎ๐ฟ๐ป ๐๐ผ ๐ฃ๐ฎ๐ฟ๐๐ฒ ๐๐ถ๐๐ฐ๐ผ ๐๐ผ๐ป๐ณ๐ถ๐ด๐๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐๐๐ถ๐ป๐ด ๐ฃ๐๐๐ต๐ผ๐ป ๐ฅ๐ฒ๐ด๐๐ :๐ฟ๐ฒ ๐ง๐๐๐ผ๐ฟ๐ถ๐ฎ๐น(๐ญ๐ฑ+ ๐ฉ๐ถ๐ฑ๐ฒ๐ผ๐)
In this video we will see how to enable logging in python
python log levels explained
critical, error warning,info debug
how to use python logging handlers
how to redirect python logs to a file email or terminal using ligging module
different types of handlers in python logging
cisco ssh connection example and enable logging to store output in to file
python logging indepth
tutorial on how to enable logging in python
how to prase cisco interface configuration
create logger objects
logging levels example
handlers
logging formatter
attributes for logging formatter
stream handler in python
smtp handler python example
script
##########
import paramiko
import time
import re
import os
import sys
import socket
import schedule
# 01 import logging
# 02 Define Logger
# 03 Set minimum logging level for logger
# 04 Create Handlers
fromaddr=EMAIL_ID,
subject="Log Alert",
credentials=(EMAIL_ID, EMAIL_PASSWORD),
secure=())
# 05 Create specific log level for Handlers
# 06 Create formatter
formatter = logging.Formatter('%(asctime)s - %(process)d- %(name)s - %(levelname)s - %(message)s')
# 07 Add Handlers
๐๐ผ๐ฟ ๐๐ผ๐บ๐ฝ๐น๐ฒ๐๐ฒ ๐ฃ๐๐๐ต๐ผ๐ป ๐ณ๐ผ๐ฟ ๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ๐ ๐ง๐๐๐ผ๐ฟ๐ถ๐ฎ๐น๐:
๐๐ป๐ฟ๐ผ๐น๐น ๐ถ๐ป ๐๐ต๐ฒ ๐ฏ๐ฒ๐น๐ผ๐ ๐จ๐ฑ๐ฒ๐บ๐ ๐๐ผ๐๐ฟ๐๐ฒ:
๐ฃ๐น๐ฎ๐๐น๐ถ๐๐: ๐ฃ๐๐๐ต๐ผ๐ป ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด ๐ณ๐ผ๐ฟ ๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ๐(๐ญ๐ฎ๐ฌ+ ๐ฉ๐ถ๐ฑ๐ฒ๐ผ๐)
โธ๐ฃ๐น๐ฒ๐ฎ๐๐ฒ ๐ณ๐ผ๐น๐น๐ผ๐ ๐ฏ๐ฒ๐น๐ผ๐ ๐๐ถ๐๐๐๐ฏ ๐ฃ๐ฎ๐ด๐ฒ ๐ณ๐ผ๐ฟ ๐๐ต๐ฒ ๐น๐ฎ๐๐ฒ๐๐ ๐ฐ๐ผ๐ฑ๐ฒ๐:
๐ฃ๐น๐ฎ๐๐น๐ถ๐๐: ๐๐ถ๐๐ฐ๐ผ ๐ก๐ซ๐๐ฃ๐-๐๐๐ ๐ฃ๐๐๐ต๐ผ๐ป ๐๐๐๐ผ๐บ๐ฎ๐๐ถ๐ผ๐ป: ๐ก๐ฒ๐ ๐๐ ๐ต๐ธ :๐ฃ๐ฎ๐ฟ๐๐ฒ ๐ท๐๐ผ๐ป ๐ซ๐ ๐ ๐๐ผ๐ป๐ณ๐ถ๐ด๐๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐๐ฎ๐๐ฎ
๐ฃ๐น๐ฎ๐๐น๐ถ๐๐: ๐๐ฒ๐ฎ๐ฟ๐ป ๐๐ผ ๐ฃ๐ฎ๐ฟ๐๐ฒ ๐๐ถ๐๐ฐ๐ผ ๐๐ผ๐ป๐ณ๐ถ๐ด๐๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐๐๐ถ๐ป๐ด ๐ฃ๐๐๐ต๐ผ๐ป ๐ฅ๐ฒ๐ด๐๐ :๐ฟ๐ฒ ๐ง๐๐๐ผ๐ฟ๐ถ๐ฎ๐น(๐ญ๐ฑ+ ๐ฉ๐ถ๐ฑ๐ฒ๐ผ๐)
In this video we will see how to enable logging in python
python log levels explained
critical, error warning,info debug
how to use python logging handlers
how to redirect python logs to a file email or terminal using ligging module
different types of handlers in python logging
cisco ssh connection example and enable logging to store output in to file
python logging indepth
tutorial on how to enable logging in python
how to prase cisco interface configuration
create logger objects
logging levels example
handlers
logging formatter
attributes for logging formatter
stream handler in python
smtp handler python example
script
##########
import paramiko
import time
import re
import os
import sys
import socket
import schedule
# 01 import logging
# 02 Define Logger
# 03 Set minimum logging level for logger
# 04 Create Handlers
fromaddr=EMAIL_ID,
subject="Log Alert",
credentials=(EMAIL_ID, EMAIL_PASSWORD),
secure=())
# 05 Create specific log level for Handlers
# 06 Create formatter
formatter = logging.Formatter('%(asctime)s - %(process)d- %(name)s - %(levelname)s - %(message)s')
# 07 Add Handlers