mirror of
https://github.com/containers/podman.git
synced 2025-10-25 18:25:59 +08:00
Add ability to retrieve container's log path to API
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #56 Approved by: rhatdan
This commit is contained in:
@ -150,6 +150,14 @@ func (c *Container) Labels() map[string]string {
|
|||||||
return labels
|
return labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LogPath returns the path to the container's log file
|
||||||
|
// This file will only be present after Init() is called to create the container
|
||||||
|
// in runc
|
||||||
|
func (c *Container) LogPath() string {
|
||||||
|
// TODO store this in state and allow overriding
|
||||||
|
return c.logPath()
|
||||||
|
}
|
||||||
|
|
||||||
// State returns the current state of the container
|
// State returns the current state of the container
|
||||||
func (c *Container) State() (ContainerState, error) {
|
func (c *Container) State() (ContainerState, error) {
|
||||||
c.lock.Lock()
|
c.lock.Lock()
|
||||||
@ -181,6 +189,11 @@ func (c *Container) bundlePath() string {
|
|||||||
return c.state.RunDir
|
return c.state.RunDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The path to the container's logs file
|
||||||
|
func (c *Container) logPath() string {
|
||||||
|
return filepath.Join(c.config.StaticDir, "ctr.log")
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieves the path of the container's attach socket
|
// Retrieves the path of the container's attach socket
|
||||||
func (c *Container) attachSocketPath() string {
|
func (c *Container) attachSocketPath() string {
|
||||||
return filepath.Join(c.runtime.ociRuntime.socketsDir, c.ID(), "attach")
|
return filepath.Join(c.runtime.ociRuntime.socketsDir, c.ID(), "attach")
|
||||||
|
|||||||
@ -139,7 +139,7 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string) error
|
|||||||
args = append(args, "-p", filepath.Join(ctr.state.RunDir, "pidfile"))
|
args = append(args, "-p", filepath.Join(ctr.state.RunDir, "pidfile"))
|
||||||
// TODO container log location should be configurable
|
// TODO container log location should be configurable
|
||||||
// The default also likely shouldn't be this
|
// The default also likely shouldn't be this
|
||||||
args = append(args, "-l", filepath.Join(ctr.config.StaticDir, "ctr.log"))
|
args = append(args, "-l", ctr.logPath())
|
||||||
args = append(args, "--exit-dir", r.exitsDir)
|
args = append(args, "--exit-dir", r.exitsDir)
|
||||||
args = append(args, "--socket-dir-path", r.socketsDir)
|
args = append(args, "--socket-dir-path", r.socketsDir)
|
||||||
if ctr.config.Spec.Process.Terminal {
|
if ctr.config.Spec.Process.Terminal {
|
||||||
|
|||||||
Reference in New Issue
Block a user