设为首页 收藏本站
查看: 1105|回复: 0

[经验分享] CISCO 日志事件的LINUX服务器

[复制链接]

尚未签到

发表于 2018-7-20 08:28:54 | 显示全部楼层 |阅读模式
  http://blog.chinaunix.net/uid-12380499-id-105686.html
  搭建记录CISCO 日志事件的LINUX服务器.
2.cisco交换机地址:10.0.0.71
  Linux地址:192.168.80.63
3.试验步骤主要分两大块
  1)交换机
  首先设置交换机能够发出日志
  开启:
(config)#loggingon   (开启日志)
(config)# loggingfacility local4 (local4设备号,这要和LINUX那对应)
(config)#logging 192.168.80.63
(config)#logging trap
logging facility命令更改设备号,并Show logging
2)LINUX
2.1 设置/etc/syslog.conf 配置文件文件(此文件是设置cisco发过来的文件到那个文件)
[root@localhost log]# vi  /etc/syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog


# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 *

# Save news errors of level crit and higher in aspecial file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log
local4.*                                             /var/log/80.log
(*表示所有消息)   (这里local4就是和cisco设置的local4对应,并且它把cisco发过来的日志放到var/log/80.log)
  可以用man syslog  共有8种消息等级.
#defineKERN_EMERG    "<0>"  /* system isunusable               */
       #defineKERN_ALERT    "<1>"  /* actionmust be taken immediately */
       #defineKERN_CRIT     "<2>"  /*criticalconditions              */
       #defineKERN_ERR      "<3>"  /*errorconditions                 */
       #defineKERN_WARNING  "<4>"  /* warningconditions               */
       #defineKERN_NOTICE   "<5>"  /* normal butsignificant condition */
       #defineKERN_INFO     "<6>"  /*informational                    */
       #defineKERN_DEBUG    "<7>"  /*debug-levelmessages             */
alert -需要立即采取的动作
   crit -临界状态
   err -错误状态。等同error
   warning -预警信息,等同warn
   notice -正常但是要注意
   info -正常消息
   debug -调试
   none -一般的信息


2.2修改配置文件/etc/sysconfig/syslog
  改这里是因为需要linux去读取来的消息

# Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
  # -x disables DNS lookups on messagesrecieved with –r (不用DNS解析)
# See syslogd(8) for more details
SYSLOGD_OPTIONS=" -m0"      修改为  SYSLOGD_OPTIONS="-r-x -m 0"
# Options to klogd
# -2 prints all kernel oops messages twice; oncefor klogd to decode, and
#    once for processing with'ksymoops'
# -x disables all klogd processing of oops messagesentirely
# See klogd(8) for more details
KLOGD_OPTIONS="-x"
#
SYSLOG_UMASK=077
# set this to a umask value to use for all log files asin umask(1).
# By default, all permissions are removed for"group" and "other".
2.3修改文件syslog 之后
    重启syslog服务
     Service syslog restart
2.4 查看syslogd进程
  ps –ef |grepsyslogd |grep –v “grep syslogd”
root     30307     1  013:59 ?       00:00:00 syslogd -r -x -m     ###有-r 就表示成功
2.5 设置LINUX 允许cisco数据包进来.
[root@localhost log]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot optsource               destination
ACCEPT     udp  --  anywhere             192.168.80.63       udpdpt:syslog

Chain FORWARD (policy ACCEPT)
target     prot optsource               destination

Chain OUTPUT (policy ACCEPT)
target     prot optsource               destination

  命令是: iptables –A INPUT –p udp –d192.168.80.63 –dport 514 –j ACCEPT
2.6  查看日志服务器监听的udp端口:514
     netstat  -untl  |grep514
udp        0      00.0.0.0:514              0.0.0.0:*        ###514 已经起来

  这样,查看80.log是否有记录
[root@localhost log]#  cat /var/log/80.log
Jan 14 21:36:06 10.0.0.71 949: 001021: *Mar 1400:47:29: %SYS-5-CONFIG_I: Configured from console by abc on vty1(192.168.2.1)
Jan 14 22:51:04 10.0.0.71 950: 001022: *Mar 1402:01:32: %LINK-3-UPDOWN: Interface FastEthernet0/7, changed state to up
Jan 14 22:51:05 10.0.0.71 951: 001023: *Mar 1402:01:33: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/7,changed state to up(完)
  来自 <http://blog.chinaunix.net/uid-12380499-id-105686.html>

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-538952-1-1.html 上篇帖子: Cisco Unified CME 7.1 Supported Firmware, Platforms, Memory, and Voice Products 下篇帖子: Cisco-Router-7206-Easy***(非模板配置)之配置终结篇
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表