LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-06-2012, 02:17 PM   #1
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Rep: Reputation: 23
How to grep *.info;mail.none;authpriv.none;cron.none; in /etc/syslog.conf


Hi,

I want to grep *.info;mail.none;authpriv.none;cron.none; this complete string in /etc/syslog.conf.
I tried with quotes and backslashes but nothing comes out.

Frnds,How to do this

Regards
 
Old 01-06-2012, 02:20 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

Doing the following, it works for me on my machine:
Code:
grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
You will just need to grep your syslog.cong file, as on my system, it is rsyslog.conf for me.

Cheers,

Josh
 
Old 01-06-2012, 02:21 PM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Enclosing it in quotes works for me. Perhaps that EXACT string is not in the file?

Code:
u@h:~$ grep "*.info;mail.none;authpriv.none;cron.none" /etc/rsyslog.conf 
*.info;mail.none;authpriv.none;cron.none                /var/log/messages
 
Old 01-06-2012, 02:34 PM   #4
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by corp769 View Post
Hello,

Doing the following, it works for me on my machine:
Code:
grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
You will just need to grep your syslog.cong file, as on my system, it is rsyslog.conf for me.

Cheers,

Josh

[root@server ~]# grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
[root@server ~]# echo $?
1
[root@server ~]#


It is not working,actually I have both files rsyslog and syslog both have same configuration settings for this.

I already tried which u have suggested.
 
Old 01-06-2012, 02:38 PM   #5
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
I would cat both files and even see if that string exists within those files.
 
Old 01-06-2012, 02:39 PM   #6
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by sharadchhetri View Post
[root@server ~]# grep "*.info;mail.none;news.none;authpriv.none;cron.none" /etc/rsyslog.conf
[root@server ~]# echo $?
1
[root@server ~]#


It is not working,actually I have both files rsyslog and syslog both have same configuration settings for this.

I already tried which u have suggested.
Oops my bad.

[root@ip-118-139-160-169 ~]# grep "*.info;mail.none;authpriv.none;cron.none;" /etc/rsyslog.conf
[root@ip-118-139-160-169 ~]# echo $?
1
[root@ip-118-139-160-169 ~]#

Now it looks my question ,I copied ur content.
Here what I suspect because of ; , it is not working.


Amaze to see it is working in my some server.

I need some standard method. I checked with awk as well but it did nt work, I need this for my script.
What the hack is it. Ok I m checking now bash version and OS also.
 
Old 01-06-2012, 02:41 PM   #7
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Wait, what exactly are you trying to say? Did you get it to work?
 
Old 01-06-2012, 02:47 PM   #8
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by sharadchhetri View Post
Oops my bad.

[root@ip-118-139-160-169 ~]# grep "*.info;mail.none;authpriv.none;cron.none;" /etc/rsyslog.conf
[root@ip-118-139-160-169 ~]# echo $?
1
[root@ip-118-139-160-169 ~]#

Now it looks my question ,I copied ur content.
Here what I suspect because of ; , it is not working.


Amaze to see it is working in my some server.

I need some standard method. I checked with awk as well but it did nt work, I need this for my script.
What the hack is it. Ok I m checking now bash version and OS also.

bash-2.05b-41.7 -- It is working in this bash

bash-3.2-24.el5 -- not Working
bash-3.0-27.el4 -- not working

Need some same output from you guys.
let me know what is ur bash version. in 3.X package it has problem
 
Old 01-06-2012, 02:51 PM   #9
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Honestly, I use zsh. I did however try in bash, and it worked for me.
Code:
[root@ltp01 ~]# bash --version
GNU bash, version 4.2.10(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[root@ltp01 ~]# zsh --version
zsh 4.3.15 (x86_64-redhat-linux-gnu)
[root@ltp01 ~]#
 
Old 01-06-2012, 02:55 PM   #10
sharadchhetri
Member
 
Registered: Aug 2008
Location: INDIA
Distribution: Redhat,Debian,Suse,Windows
Posts: 179

Original Poster
Rep: Reputation: 23
hmm cannt say with 3.x version.
But anyhow any other method,I tried awk also not worked for me.
 
  


Reply



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
Cron syslog issue manjunath.nm89 Linux - Newbie 1 09-29-2011 07:57 PM
logrotate, syslog-ng & cron hattori.hanzo Linux - Newbie 1 11-08-2006 12:08 PM
grep in syslog.conf komo Linux - General 2 11-16-2005 04:56 AM
Grep Syslog - email shell script voodoofxz Linux - Newbie 1 09-06-2005 04:27 PM
info on syslog configuration markus1982 Linux - Software 1 05-26-2003 11:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:04 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
Open Source Consulting | Domain Registration