Get log stream for the service. Note: This method works only for services with the ``json-file`` or ``journald`` logging drivers. Args: details (bool): Show extra details provided to logs. Default: ``False`` follow (bool): Kee
(self, **kwargs)
| 85 | ) |
| 86 | |
| 87 | def logs(self, **kwargs): |
| 88 | """ |
| 89 | Get log stream for the service. |
| 90 | Note: This method works only for services with the ``json-file`` |
| 91 | or ``journald`` logging drivers. |
| 92 | |
| 93 | Args: |
| 94 | details (bool): Show extra details provided to logs. |
| 95 | Default: ``False`` |
| 96 | follow (bool): Keep connection open to read logs as they are |
| 97 | sent by the Engine. Default: ``False`` |
| 98 | stdout (bool): Return logs from ``stdout``. Default: ``False`` |
| 99 | stderr (bool): Return logs from ``stderr``. Default: ``False`` |
| 100 | since (int): UNIX timestamp for the logs staring point. |
| 101 | Default: 0 |
| 102 | timestamps (bool): Add timestamps to every log line. |
| 103 | tail (string or int): Number of log lines to be returned, |
| 104 | counting from the current end of the logs. Specify an |
| 105 | integer or ``'all'`` to output all log lines. |
| 106 | Default: ``all`` |
| 107 | |
| 108 | Returns: |
| 109 | generator: Logs for the service. |
| 110 | """ |
| 111 | is_tty = self.attrs['Spec']['TaskTemplate']['ContainerSpec'].get( |
| 112 | 'TTY', False |
| 113 | ) |
| 114 | return self.client.api.service_logs(self.id, is_tty=is_tty, **kwargs) |
| 115 | |
| 116 | def scale(self, replicas): |
| 117 | """ |