Visit The New, Modern Unix Linux Community


Help need to write a script on column separation for syslog output in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help need to write a script on column separation for syslog output in perl
# 1  
Help need to write a script on column separation for syslog output in perl

HI Pros,

I have a issue.I need to write a script to parse the logs got from syslog server and update the same in my database.I need the following output.I donot know perl and I heard it very easy to write in perl

I have the sample log I need each column seperated by commas and all equals need to be removed ie date= time= needs to be removed
THis is the same log
Code:
Oct 26 09:31:17 172.16.2.1 date=2009-10-26 time=15:13:26 devname=DNBTUFW01 device_id=FG300A3908500525 log_id=0317099511 type=webfilter subtype=ftgd pri=notice vd=root policyid=19 serial=113820071 user="N/A" group="N/A" src=172.16.12.113 sport=1293 src_int="port5" dst=203.77.189.53 dport=80 dst_int="port1" service="http" method="domain" cat=52 cat_desc="Information Technology" mode="rule" rule_type="rating" rule_data="Information Technology" hostname="photos.itpro.co.uk" status=passthrough url="/images/nav_bg_high.gif" msg="URL belongs to an override rule"

I need the following output

Code:
2009-10-26, 15:13:26 , 172.16.12.113 ,1293 ,"port5" , 203.77.189.53 ,80 ,"port1" ,"http" ,"domain" , "Information Technology" , "rating" ,"Information Technology","photos.itpro.co.uk" ,passthrough ,"/images/nav_bg_high.gif"

This output will be very easy when I update in database

Last edited by pludi; 10-26-2009 at 01:38 PM.. Reason: code tags, please

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #192
Difficulty: Medium
Hello World in Python looks like this: printLine('Hello, world!')
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to write in multiple output files in perl?

hi, Hope you are doing good. During my coding yesterday i got this challenge, actually not a challenge it like to optimize the code. I am printing some statement to monitor the file progress in the log file an also to display it in the screen. so i ended up in the below statements. ... (6 Replies)
Discussion started by: mad man
6 Replies

2. Shell Programming and Scripting

How to determine column separation format?

Hi there, say I have a line with multiple columns but with different separation formats: spaces, tabs.. Is it possible to have AWK print the separation format between each column? (10 Replies)
Discussion started by: la2015
10 Replies

3. Shell Programming and Scripting

How to write Perl Script to Get MQ Queue Depth?

Hi , I got the following script from internet to display queue depth using Perl Script. However, when I execute it , im getting following error. Can anyone shed light on what is going wrong? #!/usr/bin/perl ## 07/23/01 ## Depth Inquiry sample program. ## Arguments: ## Connects to... (11 Replies)
Discussion started by: srkmish
11 Replies

4. Shell Programming and Scripting

Need a perl script to read and write the data

Hi, I have on Designdocument in that information is stored with in tabular format.I need Perlscript to read and write the datausing perl script? Regards, Ravi (0 Replies)
Discussion started by: toravi.pentaho
0 Replies

5. Shell Programming and Scripting

How to write a update query in perl script?

can any one suggest me on how to write a update query in perl script for Oracle database and also tell me abt how we can write a code for sending mails with report as attachment to appropriate persons? (1 Reply)
Discussion started by: Ramesh V Kumar
1 Replies

6. UNIX for Dummies Questions & Answers

Count the lines with the same values in a column and write the output to a file

Hey everyone! I have a tab delimited data set which I want to create an output contained the calculation of number of those lines with a certain value in 2nd and 3rd column. my input file is like this: ID1 1 10M AAATTTCCGG ID2 5 4M ACGT ID3 5 8M ACCTTGGA ID4 5 ... (7 Replies)
Discussion started by: @man
7 Replies

7. Shell Programming and Scripting

Write output to a file using Korn shell script

All, Can anyone please help me with the below scenario in korn shell script. Can anyone please give me some hints to proceed on this. I have a Flat file of the below format. Input file format:... (1 Reply)
Discussion started by: sp999
1 Replies

8. Shell Programming and Scripting

Write Awk output to a file , inside script.

Hi, Can anyone please help me with this issue. I have a Awk command which take file as input, and provides the output having multiple lines, its working in command mode, but not if i plug it in script. #!/bin/ksh infile=a.txt outfile=b.txt awk ' BEGIN{ FS=OFS="|";ORS = "\n";... (1 Reply)
Discussion started by: sp999
1 Replies

9. Shell Programming and Scripting

write a script to parse some tcpdump output

i am trying to write a script to parse some tcpdump output, in each line of the tcpdump output, I know for sure there are 3 keywords exist: User{different usernamehere} NAS_ipaddr{different ip here} Calling_station{ip or dns name here} But the positions for these 3 keywords in the... (4 Replies)
Discussion started by: fedora
4 Replies

10. Shell Programming and Scripting

Need help to write a Perl script

Hello friends, I am having a awk script which does my goal , but I want to learn perl , after learning the basics in perl now I am trying to convert my nawk script to perl . Please help me to do some task in perl that I ve already did in nawk. Like I am facing some problem in... (10 Replies)
Discussion started by: user_prady
10 Replies

Featured Tech Videos