github.com/greenboxal/deis@v1.12.1/deisctl/backend/fleet/journal.go (about) 1 package fleet 2 3 import ( 4 "fmt" 5 ) 6 7 // Journal prints the systemd journal of target unit(s) 8 func (c *FleetClient) Journal(target string) (err error) { 9 units, err := c.Units(target) 10 if err != nil { 11 return 12 } 13 for _, unit := range units { 14 c.runJournal(unit) 15 } 16 return 17 } 18 19 // runJournal tails the systemd journal for a given unit 20 func (c *FleetClient) runJournal(name string) (exit int) { 21 u, err := c.Fleet.Unit(name) 22 if suToGlobal(*u) { 23 fmt.Fprintf(c.errWriter, "Unable to get journal for global unit %s. Check on a host directly using journalctl.\n", name) 24 return 1 25 } 26 27 machineID, err := c.findUnit(name) 28 29 if err != nil { 30 return 1 31 } 32 33 command := fmt.Sprintf("journalctl --unit %s --no-pager -n 40 -f", name) 34 return c.runCommand(command, machineID) 35 }