Usage • Installation • Flags • Contributing •
plogs
is a kubernetes plugin that facilitates retrieving logs from Kubernetes pods with various filtering and highlighting options. It allows users to specify the namespace, container name, labels, and mark specific words for highlighting within the logs stream.
You can install the "plogs" plugin using krew
kubectl krew install plogs
Linux Packages
-
Bash Install Script
By default, plogs is going to be installed at
/usr/bin/
.sudo
privileges are required for this operation.If you would like to provide a custom install path, you can do so as an input to the script. For example, you can run
./install.sh $HOME/bin
to install plogs in the specified directory.
curl -sL https://bit.ly/installplogs | sudo sh
OR
curl -s https://raw.githubusercontent.com/kha7iq/plogs/main/install.sh | sudo sh
- DEB & RPM
# DEB
export PLOGS_VERSION="0.1.1"
wget -q https://github.com/kha7iq/plogs/releases/download/v${PLOGS_VERSION}/plogs_amd64.deb
sudo dpkg -i plogs_amd64.deb
# RPM
sudo rpm -i plogs_amd64.rpm
Manual
# Chose desired version
export PLOGS_VERSION="0.1.1"
wget -q https://github.com/kha7iq/plogs/releases/download/v${PLOGS_VERSION}/plogs_linux_amd64.tar.gz && \
tar -xf plogs_linux_amd64.tar.gz && \
chmod +x plogs && \
sudo mv plogs /usr/bin/kubectl-plogs
Checkout release page for all supported OS binaries.
-
--mark, -m
- Usage:
--mark <word>
- Alias:
-m
- Marks logs containing the specified word or sentence.
- Usage:
-
--namespace, -n
- Usage:
--namespace <namespace>
- Alias:
-n
- Specifies the Kubernetes namespace. If not specified, uses the namespace set in the context. If context namespace is also empty, defaults to "default".
- Usage:
-
--container, -c
- Usage:
--container <containerName>
- Alias:
-c
- Specifies the container name within the pod. If not specified and the pod has multiple containers, defaults to the first container.
- Usage:
-
--label, -l
- Usage:
--label <labels>
- Alias:
-l
- Specifies labels to match for pods.
- Usage:
-
--pod, -p
- Usage:
--pod <podName>
- Alias:
-p
- Specifies the pod name.
- Usage:
-
--follow, -f
- Usage:
--follow
- Alias:
-f
- Specifies to follow logs continuously.
- Usage:
-
--tail, -t
- Usage:
--tail <lines>
- Alias:
-t
- Specifies the number of lines to show from the end of logs.
- Usage:
Consider adding this alias to your .bashrc
or .zshrc
for convenience.
echo "alias kpl='kubectl plogs'" >> .bashcr
echo "alias kplf='kubectl plogs -f'" >> .bashrc
- Retrieve logs from all pods matching label
kpl -n dev -l app=myapp -m "fail" -p my-pod -t 10
- Retrieve logs for a specific pod:
kplf -n dev -p my-pod -t 10
- Kubernetes cluster access or kubeconfig set up
If you encounter any problems or have suggestions for improvements, please open an issue on GitHub.
Contributions, issues and feature requests are welcome!
Feel free to check
issues page. You can also take a look
at the contributing guide.