Last active
June 4, 2020 01:34
-
-
Save r1ddl3m37h15/e692c36bc19db107066cd9e66578551f to your computer and use it in GitHub Desktop.
log parse count dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fileinput | |
from datetime import datetime | |
import matplotlib.pyplot as plt | |
from matplotlib.dates import DateFormatter | |
x, y = [], [] | |
for line in fileinput.input(): | |
y.append(int(line.split()[0])) | |
x.append(datetime.fromisoformat(line.split()[1])) | |
fig, ax = plt.subplots() | |
ax.plot(x,y) | |
myFmt = DateFormatter("%d") | |
ax.xaxis.set_major_formatter(myFmt) | |
## Rotate date labels automatically | |
fig.autofmt_xdate() | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
grep -o "[0-9]\{1,4\}-[0-9]\{1,2\}-[0-9]\{1,4\}" sample.log | sort | uniq -c | python3 ./date.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment