Sponsored Content
Top Forums Shell Programming and Scripting Parsing kiwi syslog from Astaro Post 302518933 by ctsgnb on Monday 2nd of May 2011 02:04:32 PM
Old 05-02-2011
Code:
awk -F"[=[:blank:]]" '{for(i=1;i<=NF;i++) if($i~/scrip|scrport|dstip|dstport/) printf $(i+1)" ";printf "\n"}' yourlogfile

removing double quote around values:

Code:
awk -F"[=[:blank:]]" '{gsub("\"",x,$0);for(i=1;i<=NF;i++) if($i~/scrip|scrport|dstip|dstport/) printf $(i+1)" ";printf "\n"}' yourlogfile

use nawk instead of awk if on Solaris/SunOS

Last edited by ctsgnb; 05-02-2011 at 03:16 PM..
 

We Also Found This Discussion For You

1. Shell Programming and Scripting

Parsing syslog from Linux

Hello, I'm facing problem to extract fields from below syslog : logver=56 idseq=63256900099118326 itime=1563205190 devid=FG-5KDTB18800138 devname=LAL-C1-FGT-03 vd=USER date=2019-07-15 time=18:39:49 logid="0000000013" type="traffic" subtype="forward" level="notice" eventtime=1563205189... (17 Replies)
Discussion started by: arm
17 Replies
SYSLOG(8)                                                         System Logging                                                         SYSLOG(8)

NAME
syslog-ng, syslogd DESCRIPTION
There are different syslog daemon implementations supported as the system's syslog service, currently syslogd, syslog-ng and rsyslogd The first installed daemon activates itself for the syslog service. Starting with openSUSE-11.2, it is rsyslogd, before it was syslog-ng. But this depends on the software selection during the installation. The name of the daemon used as syslog service is specified in the SYSLOG_DAEMON variable in /etc/sysconfig/syslog. The yast2 sysconfig module provides a comfortable way to switch to another installed daemon and restart the service. The /etc/init.d/syslog init script is able to handle all supported daemons. BUGS
Please report bugs at <http://www.suse.de/feedback> AUTHOR
Juergen Weigert <jw@novell.com> Marius Tomaschewski <mt@novell.com> SEE ALSO
sysklogd(8) syslogd(8) syslog.conf(5) syslog-ng(8) syslog-ng.conf(5) rsyslogd(8) rsyslog.conf(5) syslog May 2008 SYSLOG(8)
All times are GMT -4. The time now is 01:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy