Re: [SOMEWHAT SOLVED] Question about remote syslog logging during kickstart

Chun Tat David Chu <[email protected]>
Newsgroups gmane.linux.redhat.kickstart.general
Message-ID <CANCf8oLCwtO2x8RaP7DewcFtdQxPUAaJQ7V0tz7axQxPo9dxMA@mail.gmail.com>
In case anyone would like to know, Below is my current solution.  Basically
I am using Anaconda Python logging facility.

Please let me know if anyone has any more alternative solutions.

Thanks,

David

#!/usr/bin/python
import syslog
import time
import sys
sys.path.append("/mnt/runtime/usr/lib/anaconda")
from anaconda_log import logger
import logging
def main():
    log = logging.getLogger("anaconda")
    logger.addSysLogHandler(log, <remote syslog server ip>)
    counter = 0
    while True:
        counter = counter + 1
        msg = "TESTING: %d" % counter
        log.info(msg)
        time.sleep(1)
# This module represents the scope in which the interpreter's
# main program executes
if __name__ == "__main__":
    main()

On Mon, Jul 25, 2011 at 3:33 PM, Chun Tat David Chu <
[email protected]> wrote:

> Hi All,
>
> This is related with remote syslog logging during kickstart in %pre and
> %post.
>
> Is there a way I can utilize what Anaconda is using to do remote syslog
> logging?
>
> I tried to write a Python script that invokes on the syslog.syslog()
> function but no luck.  It is only logging to the local /tmp/syslog file.  Is
> there a way I can get it to log to a remote syslog server?
>
> Thanks!!
>
> David
>
> On Mon, Jul 18, 2011 at 1:30 PM, Chun Tat David Chu <
> [email protected]> wrote:
>
>> Hi All,
>>
>> I know that you can specify logging host by including 'logging --host
>> <hostname>' in the kickstart file so that Anaconda will log remotely.
>>
>> What I would like is to log custom messages during %pre and %post but I
>> couldn't figure out how to do so.
>>
>> It appears 'logger' is not available during %pre.
>>
>> My question is how to log remotely during %pre and %post.
>>
>> I am currently using RHEL 5.2.
>>
>> Thanks!
>>
>> - David
>>
>
>

_______________________________________________
Kickstart-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/kickstart-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.