เขียนข้อความลงในบันทึก


16

เป็นไปได้ไหมที่จะเขียนข้อความตามอำเภอใจลงในบันทึกของอุปกรณ์ Cisco IOS 12.x?

ฉันควรจะใส่เครื่องหมายเมื่อดึงข้อมูลการกำหนดค่าผ่าน TFTP และฉันต้องการที่จะมีบรรทัดบันทึกข้อมูล

 May 30 14:14:00.000: %CONFIG-REMARK: Halfway through the script! Now on to SomethingThatMightFail!
 May 30 14:14:05.000: %CONFIG-REMARK: SomethingThatMightFail didn't fail! Woo! Continuing!

คำตอบ:


19

คุณสามารถใช้send logคำสั่ง:

switch#send log Halfway through the script!

ให้ Catalyst 3750 กับ IOS 12.2 ของฉัน

May 31 16:36:18: %SYS-2-LOGMSG: Message from 1(name): Halfway through the script!

และด้วย IOS 15.0:

May 31 16:38:08: %SYS-7-USERLOG_DEBUG: Message from tty1(user id: name): Halfway through the script!

คุณสมบัติที่น่าสนใจ
Adam Loveless

อร่อยและตรงจุด Vielen Dank, Stefan
Jan

หมายเหตุ: 7600 กับ 12.2 (33) ให้บรรทัดเดียวกับ IOS 15 ของคุณตัวอย่างเช่น :-)
มกราคม 13 มกราคม

2

สมมติว่าคุณกำลังใช้ TCL EEM คุณสามารถใช้action_syslog


ไม่ไม่มี TCL ในเครือข่ายของเรา เชลล์สคริปต์ใช้ clogin
Jan

2

ไวยากรณ์สำหรับการส่ง syslog ทดสอบจากอุปกรณ์ Cisco นั้นขึ้นอยู่กับรุ่นของซอฟต์แวร์ นี่คือไวยากรณ์คำสั่งที่ฉันได้เห็นรวมถึงหากมีตัวเลือกสำหรับการตั้งค่าความรุนแรง syslog:

แพลตฟอร์ม Cisco ส่วนใหญ่หากใช้ IOS 12.2 (58) ขึ้นไป:

send log [severity] [text to send]
Eg:
send log
send log   This message will go to my syslog server.
send log 5 This message will go to my syslog server.

แพลตฟอร์ม Cisco ส่วนใหญ่หากใช้ IOS 12.2 (52) และต่ำกว่า:

send log [text to send]
Eg:
send log
send log   This message will go to my syslog server.

ASR1000 ที่ใช้ IOS-XE 03.01.00 ซึ่งมาจาก IOS 15.0 (1):

send log [severity [text to send]]
Eg:
send log
send log 5 This message will go to my syslog server.

ASR1000 ที่ใช้ IOS-XE รุ่นอื่น (รวมถึง 02.04.03 จาก IOS 12.2 (33), 03.04.04 จาก IOS 15.1 (3), 03.14.00 จาก IOS 15.5 (1)):

send log [severity] [text to send]
Eg:
send log
send log   This message will go to my syslog server.
send log 5 This message will go to my syslog server.

ASR9000 ที่ใช้ IOS-XR 4.2.1 และสูงกว่า:

log <text to send>
Eg:
log This message will go to my syslog server.

WS-C6513 ใช้ IOS 12.2 (18): ไม่มีคำสั่งเทียบเท่า คุณต้องใช้วิธีอื่นในการสร้างข้อความ syslog ตัวอย่างเช่นสิ่งต่อไปนี้ควรสร้าง 5 syslogs (อินเตอร์เฟสขึ้น, line line up, down down, โปรโตคอล line down และเปลี่ยนการกำหนดค่า) ขึ้นอยู่กับการตั้งค่าการบันทึกของคุณ ออกจากคำสั่งอินเตอร์เฟส 2 คำสั่งเพื่อสร้าง syslog ที่เปลี่ยนแปลงการกำหนดค่าทั่วไป

config t
interface loopback601
no interface loopback601
end
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.