Skip to content

Instantly share code, notes, and snippets.

@djfarrelly
Last active August 11, 2016 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djfarrelly/679b37615dd2df2c3b043c5bc93ff07c to your computer and use it in GitHub Desktop.
Save djfarrelly/679b37615dd2df2c3b043c5bc93ff07c to your computer and use it in GitHub Desktop.
FROM alpine:3.3
ADD logger.sh /logger.sh
RUN chmod +x /logger.sh
CMD /bin/sh -c "/logger.sh"
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: default
name: log-collector-test
spec:
replicas: 1
template:
metadata:
labels:
app: log-collector-test
spec:
containers:
- image: bufferapp/buffer-log-collector-tester:1
name: app
volumeMounts:
- name: log-storage
mountPath: /var/log
- name: log-collector
image: bufferapp/buffer-log-collector:0.2
volumeMounts:
- name: log-storage
readOnly: true
mountPath: /var/log
resources:
limits:
cpu: 100m
memory: 200Mi
imagePullSecrets:
- name: dhbufferapp
restartPolicy: Always
volumes:
- name: log-storage
emptyDir: {}
#!/bin/sh
HOSTNAME=$(hostname)
while true
do
TIMESTAMP=$(date "+%Y-%m-%dT%H:%M:%S.000Z")
ENTRY="{\
\"name\": \"Log-Tester\",\
\"hostname\": \"$HOSTNAME\",\
\"@timestamp\": \"$TIMESTAMP\"\
\"msg\": \"ok\"\
}"
echo $ENTRY >> /var/log/application.log
echo $ENTRY
METRIC="{\
\"name\": \"Log-Tester\",\
\"date\": \"$TIMESTAMP\"\
\"value\": { \"something\": 1234 }\
}"
echo $METRIC >> /var/log/metrics.log
echo $METRIC
sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment