• Tag : log


Collecting logs for Arista TAC cases using logGrab

logGrab is a simple bash script that builds a time/date stamped archive containing a number of log items commonly requested when raising a TAC case. It is designed to simplify the process of collecting data from multiple sources within EOS and packing them into a single file for easy upload. The script can be easily extended/adapted and may be integrated easily with other EOS features such as the CLI scheduler and Advanced Event Manager. #!/bin/bash # logGrab - Automatic Log Collector v0.3 LOGNAME=logGrab-$HOSTNAME-$(date +%Y-%m-%d.%H%M%S) mkdir /mnt/flash/$LOGNAME cd /mnt/flash/$LOGNAME ls -alR /persist/sys > persist-sys-contents ls -alR /mnt/flash > flash-contents ls -alR...
Continue reading →

Reacting to syslog-triggered events

EOS in tandem with Python scripting can provide the network operator an invaluable tool that is driven by local log entries on the switch. The script presented here continuously monitors /var/log/messages for new entries as it contains verbose, unfiltered entries. The script then searches each log entry using the built-in Python regular expression module. When a matching entry is found (this script is looking for major errors) it saves the output of ‘show tech-support’ to internal flash. For every match, the script checks for the existence of a ‘show tech-support’ file to ensure it doesn’t create a duplicate entry for...
Continue reading →

How to generate syslog messages using Python

Arista EOS extensions can be easily configured to generate syslog messages. This documents provides an overview of the APIs which can be used in order to achieve that and shows a few examples. The examples presented in the following sections were tested against EOS-4.12.0. Basic example #!/usr/bin/env python # Copyright (c) 2013 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import syslog syslog.openlog( 'myTestLog', 0, syslog.LOG_LOCAL4 ) syslog.syslog( '%%TEST-6-LOG: Log msg: %s' % 'test msg' ) Result Apr 17 07:15:40 <hostname> myTestLog: %TEST-6-LOG: Log msg: test msg See the official Python documentation for more details.


Get every new post on this blog delivered to your Inbox.

Join other followers: