Find the answer to your Linux question:
Results 1 to 1 of 1
Hi, I've installed pop-before-smtp perl script in my mail server. I need help to configure the $pat to read the pattern of my Dovecot file. Dovecote log file is like ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    5

    regex for perl


    Hi,

    I've installed pop-before-smtp perl script in my mail server. I need help to configure the $pat to read the pattern of my Dovecot file. Dovecote log file is like attached image, i'm not allowed to post email link here as it's my first post:


    The perl script by default offer this pattern for Dovecot. But it's not working for me

    Code:
    # For Dovecot POP3/IMAP when using syslog.
    $pat = '^[LOGTIME] \S+ (?:dovecot: )?(?:imap|pop3)-login: ' .
        'Login: .*? (?:\[|rip=)[:f]*(\d+\.\d+\.\d+\.\d+)[],]';
    $out_pat = '^[LOGTIME] \S+ (?:dovecot: )?(?:imap|pop3)-login: ' .
        'Disconnected.*? (?:\[|rip=)[:f]*(\d+\.\d+\.\d+\.\d+)[],]';
    
    # For Dovecot POP3/IMAP when it does its own logging.
    $logtime_pat = '(\d\d\d\d-\d+-\d+ \d+:\d+:\d+)';
    $pat = '^dovecot: [LOGTIME] Info: (?:imap|pop3)-login: ' .
        'Login: .+? rip=[:f]*(\d+\.\d+\.\d+\.\d+),';
    $out_pat = '^dovecot: [LOGTIME] Info: (?:imap|pop3)-login: ' .
        'Disconnected.*? rip=[:f]*(\d+\.\d+\.\d+\.\d+),';
    
    # For older Dovecot POP3/IMAP when it does its own logging.
    $pat = '^(?:imap|pop3)-login: [LOGTIME] Info: ' .
        'Login: \S+ \[[:f]*(\d+\.\d+\.\d+\.\d+)\]';
    $out_pat = '^(?:imap|pop3)-login: [LOGTIME] Info: ' .
        'Disconnected.*? \[[:f]*(\d+\.\d+\.\d+\.\d+)\]';
    Thanks for you help in advance.
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •