LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-25-2011, 05:20 AM   #1
catalint
LQ Newbie
 
Registered: May 2011
Posts: 7

Rep: Reputation: 0
parse /etc/syslog.conf file


Hello there,

Guys I've got an issue and I need a hint...I have to create a sh script which parse /etc/syslog.conf file (under solaris) and need to get all path accordingly to all logs configured in there.

If anybody knows more about this please let me know. Thanks .
 
Old 05-25-2011, 07:25 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
What have you tried so far? What are the contents of /etc/syslog.conf?
 
Old 05-25-2011, 07:34 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
About trying awk? Pretty easy to parse with AWK -- I'd check to see if awk is linked to oawk or nawk and use nawk if it's linked to oawk but other than that it ought to be straightforward.

Hope this helps some.
 
Old 05-26-2011, 03:02 AM   #4
catalint
LQ Newbie
 
Registered: May 2011
Posts: 7

Original Poster
Rep: Reputation: 0
Hello,

The content of the file is bellow.Right now I'm trying to find what to use..awk or sed, i don't have so much experience with these tools and I need some ideas. I need to get from this config file ALL the paths to log files that are configured , for example /var/adm/messages



#ident "@(#)syslog.conf 1.5 98/12/14 SMI" /* SunOS 5.0 */
#
# Copyright (c) 1991-1998 by Sun Microsystems, Inc.
# All rights reserved.
#
# syslog configuration file.
#
# This file is processed by m4 so be careful to quote (`') names
# that match m4 reserved words. Also, within ifdef's, arguments
# containing commas must be quoted.
#
*.err;kern.notice;auth.notice /dev/sysmsg
*.err;kern.debug;daemon.notice;mail.crit /var/adm/messages

*.alert;kern.err;daemon.err operator
*.alert root

*.emerg *

# if a non-loghost machine chooses to have authentication messages
# sent to the loghost machine, un-comment out the following line:
#auth.notice ifdef(`LOGHOST', /var/log/authlog, @loghost)

mail.debug ifdef(`LOGHOST', /var/log/syslog, @loghost)

#
# non-loghost machines will use the following lines to cause "user"
# log messages to be logged locally.
#
ifdef(`LOGHOST', ,
user.err /dev/sysmsg
user.err /var/adm/messages
user.alert `root, operator'
user.emerg *
)
 
Old 05-26-2011, 07:38 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by catalint View Post
Right now I'm trying to find what to use..awk or sed
If you know C then awk will come more naturally than sed after you have familiarised with the pattern-action concept and awk is more powerful than sed, being a full programming language as opposed to a very competent stream editor.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] xorg.conf causes parse error on line 1 of section InputClass JZL240I-U Linux - Desktop 18 03-08-2011 04:27 AM
Configure httpd.conf to parse .php files grob115 Programming 2 07-07-2010 05:31 AM
About syslog.conf? mmee Linux - Newbie 3 02-24-2009 01:55 AM
host: parse of /etc/resolv.conf failed D.A. Linux - Software 4 08-09-2007 01:30 PM
could not parse yaboot.conf when server starting webeye Linux - Newbie 1 02-13-2006 05:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration