Code Monkey home page Code Monkey logo

Comments (3)

laurenz avatar laurenz commented on August 18, 2024

I need %c in log_line_prefix so that I can identify sessions.

Is it an option to use log_destination = csvlog? That would be better anyway, and the documentation seems to suggest that log_destination is modifiable.

from pgreplay.

gilly3 avatar gilly3 commented on August 18, 2024

Session id comes from process id and process start time. Documentation:

The %c escape prints a quasi-unique session identifier, consisting of two 4-byte hexadecimal numbers (without leading zeros) separated by a dot. The numbers are the process start time and the process ID

Could process id (%p) be made to substitute for session id?

I'll try log_destination = csvlog for future logs. In the meantime, I'm stuck with a pile of logs from just before a failure that are in the wrong format. I'd love to be able to replay those logs and see if I can reproduce the failure.

from pgreplay.

laurenz avatar laurenz commented on August 18, 2024

The process ID is not unique, it can be reused, so I cannot use it as a session identifier.

I understand your situation, because I was in exactly the same situation once. That made me write pgreplay!

What you could do is to pre-process the logs with sed or something similar to get them into a format that pgreplay can understand. The important thing is that you have log_min_duration_statement set to 0 (and not log_statement = 'all', which would log the statements after they are done).

You'd have to fix the timestamp to contain milliseconds, and you'd have to fake the session ID, maybe by using a zero timestamp part and the process ID in hex. The hard part are continuation lines if you have statements with line breaks in them. Each such continuation line will start with a tab, so don't modify such lines.

from pgreplay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.