Thread

  1. archive_command debugging

    postgres@arcict.com — 2023-08-23T15:07:01Z

    Hello,
    
    I was wondering if anyone had any good tips for "debugging" the archive_command in the postgresql.conf.
    
    I want to see what certain settings are when the command is run, like $PATH and id, but I don't want it to be successful either, so that the WAL files remain untouched.
    
    Any tips?
    
    Thanks,
    
    Nick Renders
    
    
    
    
  2. Re: archive_command debugging

    Christoph Moench-Tegeder <cmt@burggraben.net> — 2023-08-23T16:03:23Z

    ## Nick Renders (postgres@arcict.com):
    
    > I was wondering if anyone had any good tips for "debugging" the
    > archive_command in the postgresql.conf.
    
    For starters, you get rather noisy logging when that command fails
    (plus all the output from the command itself), so check your postgres
    logfile first. Also, you get some additional debug logging at level
    DEBUG3.
    Then archive_command basically inherits it's environment and user id
    from the archiver process, so you could check that process' proc entries.
    Third, archive_command is executed via system() (after template
    processing), so you're free to do... quite a lot in there (just
    don't mess with the exit status). It might be more convenient to
    use some shell wrapper around your final archive command and have
    that wrapper do all the logging etc. you might want.
    
    And a final tip: do not rely on the environment, always use full
    paths, and if you ever might have whitespace or other "funny
    characters" in some path/file name (or always, just to be safe)
    make sure you get your quoting right.
    
    Regasrds,
    Christoph
    
    -- 
    Spare Space