Re: Python log parser

2013-04-05 Thread darnold
i know literally nothing about syslogs, but a google search for
"python syslog parser" shows that some people have had success using
the pyparsing module:

http://www.j-schmitz.net/blog/how-to-parse-a-syslog-logfile-in-python
https://gist.github.com/leandrosilva/3651640

hth,
Don
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python log parser

2013-04-05 Thread Nac Temha
On Fri, Apr 5, 2013 at 4:31 PM, Grant Edwards wrote:

> On 2013-04-05, rh  wrote:
> > On Fri, 5 Apr 2013 02:17:55 +0300 Nac Temha 
> wrote:
> >
> >> Hi, I'm working to parse log files. But I need to help this matter. I
> >> want to parse syslog(wihch program is running, timestamp,host,etc) of
> >> system I could not find any module of python for this. Or do you have
> >> suggestion?
> >
> > pydoc syslog
> >
> > That intenough?
>
> No.  Can you be more specific?  All the documentation I've found for
> the syslog module is for _generating_ log entries (it's a wrapper for
> the Unix syslog library).
>
>
Thanks for understand me.


> That's not what the OP asked about.
>
> The OP asked about parsing syslog files, not generating syslog file
> entries.
>
>
Can syslog module parsing syslog messages? I give you example for better
explain this matter; I can parse perl module(
http://search.cpan.org/dist/Parse-Syslog/lib/Parse/Syslog.pm). I obtained
host,program,message text. I want to do them with python.




> Parsing syslog files is not a well-defined problem.  The format of a
> syslog file depends on which system log daemon you're running and now
> it's configured.
>
> --
> Grant Edwards   grant.b.edwardsYow! Do I have a
> lifestyle
>   at   yet?
>   gmail.com
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python log parser

2013-04-05 Thread Grant Edwards
On 2013-04-05, Dave Angel  wrote:
> On 04/05/2013 07:20 AM, Nac Temha wrote:

>> I could not do using syslog module.

> What could you not do using syslog?

Parse syslog files, presumably -- that's what he asked about.

> What did you try, and what exception did it throw?

I'm rather at a loss as to how the syslog module can be used to parse
syslog files.  Perhaps somebody can be a little more detailed?

-- 
Grant Edwards   grant.b.edwardsYow! I am a jelly donut.
  at   I am a jelly donut.
  gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python log parser

2013-04-05 Thread Grant Edwards
On 2013-04-05, rh  wrote:
> On Fri, 5 Apr 2013 02:17:55 +0300 Nac Temha  wrote:
>
>> Hi, I'm working to parse log files. But I need to help this matter. I
>> want to parse syslog(wihch program is running, timestamp,host,etc) of
>> system I could not find any module of python for this. Or do you have
>> suggestion?
>
> pydoc syslog
>
> That intenough?

No.  Can you be more specific?  All the documentation I've found for
the syslog module is for _generating_ log entries (it's a wrapper for
the Unix syslog library).

That's not what the OP asked about.

The OP asked about parsing syslog files, not generating syslog file
entries.

Parsing syslog files is not a well-defined problem.  The format of a
syslog file depends on which system log daemon you're running and now
it's configured.

-- 
Grant Edwards   grant.b.edwardsYow! Do I have a lifestyle
  at   yet?
  gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python log parser

2013-04-05 Thread Dave Angel

On 04/05/2013 07:20 AM, Nac Temha wrote:

I could not do using syslog module.



Please don't top-post.  It messes up the history order entirely.

What could you not do using syslog?  What did you try, and what 
exception did it throw?


Show your code, and either say precisely in what way it didn't "work" or 
post the full exception traceack.



--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python log parser

2013-04-05 Thread Nac Temha
I could not do using syslog module.


On Fri, Apr 5, 2013 at 4:00 AM, rh  wrote:

> pydoc syslog
>
> That intenough?
>
> On Fri, 5 Apr 2013 02:17:55 +0300
> Nac Temha  wrote:
>
> > Hi, I'm working to parse log files. But I need to help this matter. I
> > want to parse syslog(wihch program is running, timestamp,host,etc) of
> > system I could not find any module of python for this. Or do you have
> > suggestion?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list