Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. With replicasets as (
  2. select
  3. e.event.reason as reason,
  4. e.event.lastTimestamp as ts,
  5. e.event.metadata.name as name,
  6. REGEXP_EXTRACT(e.event.message, 'Created pod: (.*)', 1) as pod
  7. from
  8. commons.eventrouter_events e
  9. where
  10. e.event.involvedObject.kind = 'ReplicaSet'
  11. and e.event.metadata.namespace = 'production'
  12. and e.event.reason = 'SuccessfulCreate'
  13. ),
  14. pods as (
  15. select
  16. e.event.reason as reason,
  17. e.event.message as message,
  18. e.event.lastTimestamp as ts,
  19. e.event.involvedObject.name as name,
  20. REGEXP_EXTRACT(
  21. e.event.message,
  22. 'pulling image "imagerepo/folder/(.*?)"',
  23. 1
  24. ) as image
  25. from
  26. commons.eventrouter_events e
  27. where
  28. e.event.involvedObject.kind = 'Pod'
  29. and e.event.metadata.namespace = 'production'
  30. and e.event.message like '%pulling image%'
  31. and e.event.involvedObject.name like 'aggregator%'
  32. )
  33.  
  34. SELECT * from (
  35. select
  36. MAX(p.ts) as ts, MAX(r.pod) as pod, MAX(p.image) as image, r.name
  37. from
  38. pods p
  39. JOIN replicasets r on p.name = r.pod
  40. GROUP BY r.name) sq
  41. ORDER BY ts DESC
  42. limit 100;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement