Skip to content

Commit

Permalink
added cloudwatch tailing executed directly in terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Koval committed Feb 1, 2017
1 parent 34643fb commit 5ff9e87
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 16 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ To perform a query against your selected profile. Alfred will then auto-populate
#### Modifier Key Cheat Sheet
Below is a table describing the currently supported AWS resource lookups and what Alfred will do upon hitting **Enter** when combined with modifier keys:

| | (none) | Cmd | Alt / Option | Ctrl | Shift <sub>(_press_, not hold)</sub> |
| :---: | --- | --- | --- | --- | --- |
| ![](icons/cfn_stack.png)CloudFormation | Open stack in AWS console | | | | Quicklook |
| ![](icons/services/cloudwatch.png)CloudWatch Log Group | Open log group in AWS console | Copies `awslogs` command to clipboard for tailing | | | Quicklook |
| ![](icons/ec2_instance.png)<br/>EC2 | Copies _private_ IP | Open instance in AWS console | Copies _public_ IP (if available) | | Quicklook |
| ![](icons/eb_environment.png)<br/>Elastic Beanstalk | Open environment in AWS Console | Copies load balancer URL (if available) | | | Quicklook |
| ![](icons/services/lambda.png)<br/>Lambda | Open function in AWS console | Open CloudWatch log group in AWS Console | | | Quicklook |
| ![](icons/db_instance.png)![](icons/db_cluster.png)<br/>RDS | Copy endpoint URL | Open cluster or node in AWS Console | | | Quicklook |
| ![](icons/services/redshift.png)<br/>Redshift | Open cluster in AWS console | Copies first node's _private_ IP (if available) | Copies first node's _public_ IP (if available) | | Quicklook |
| ![](icons/s3_bucket.png)<br/>S3 | Open bucket in AWS Console | | | | Quicklook |
| ![](icons/sqs_queue.png)<br/>SQS | Open queue in AWS console | Copy queue URL | | | Quicklook |
| | (none) | Cmd | Alt / Option | Ctrl | Shift <sub>(_press_, not hold)</sub> |
| :---: | --- | --- | --- | --- | --- |
| ![](icons/cfn_stack.png)CloudFormation | Open stack in AWS console | | | | Quicklook |
| ![](icons/services/cloudwatch.png)CloudWatch Log Group | Open log group in AWS console | Executes `awslogs` command in terminal for tailing (requires `awslogs` on your `$PATH`!) | Copies `awslogs` tail command to clipboard | | Quicklook |
| ![](icons/ec2_instance.png)<br/>EC2 | Copies _private_ IP | Open instance in AWS console | Copies _public_ IP (if available) | | Quicklook |
| ![](icons/eb_environment.png)<br/>Elastic Beanstalk | Open environment in AWS Console | Copies load balancer URL (if available) | | | Quicklook |
| ![](icons/services/lambda.png)<br/>Lambda | Open function in AWS console | Open CloudWatch log group in AWS Console | | | Quicklook |
| ![](icons/db_instance.png)![](icons/db_cluster.png)<br/>RDS | Copy endpoint URL | Open cluster or node in AWS Console | | | Quicklook |
| ![](icons/services/redshift.png)<br/>Redshift | Open cluster in AWS console | Copies first node's _private_ IP (if available) | Copies first node's _public_ IP (if available) | | Quicklook |
| ![](icons/s3_bucket.png)<br/>S3 | Open bucket in AWS Console | | | | Quicklook |
| ![](icons/sqs_queue.png)<br/>SQS | Open queue in AWS console | Copy queue URL | | | Quicklook |

... more resources and modifiers to be implemented. Feel free to [fork this repo](#fork-destination-box) to implement your own!

Expand Down
16 changes: 11 additions & 5 deletions aws_workflow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,18 @@ def populate_menu_item(self, wf, group, title, uid, region_name, quicklookurl, p
awslogs_command = 'awslogs get %s -w --aws_region %s --profile %s' % (group_name, region_name, profile)
cmdmod = item.add_modifier(
'cmd',
subtitle='copy `awslogs` tail command to clipboard',
subtitle='execute `awslogs` tail command in terminal',
arg=awslogs_command,
valid=True,
)
cmdmod.setvar('action', 'copy-to-clipboard,post-notification')
cmdmod.setvar('notification_title', 'Copied to Clipboard')
cmdmod.setvar('notification_text', awslogs_command)

cmdmod.setvar('action', 'execute-terminal')

altmod = item.add_modifier(
'alt',
subtitle='copy `awslogs` tail command to clipboard',
arg=awslogs_command,
valid=True,
)
altmod.setvar('action', 'copy-to-clipboard,post-notification')
altmod.setvar('notification_title', 'Copied `awslogs` Command')
altmod.setvar('notification_text', awslogs_command)
71 changes: 71 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
<false/>
</dict>
</array>
<key>76C5B220-7C6A-45F7-AFD9-12AA7EDFD839</key>
<array>
<dict>
<key>destinationuid</key>
<string>F51858AD-13C1-46B3-A32A-03FF8DEB45AE</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>7A0B639E-7E89-4443-8D59-6E486E864315</key>
<array>
<dict>
Expand Down Expand Up @@ -89,6 +102,16 @@
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>76C5B220-7C6A-45F7-AFD9-12AA7EDFD839</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>BB748CAD-7275-47A8-85B9-C4E389CF25C9</key>
<array>
Expand Down Expand Up @@ -334,6 +357,40 @@
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>{query}</string>
</dict>
<key>type</key>
<string>alfred.workflow.action.terminalcommand</string>
<key>uid</key>
<string>F51858AD-13C1-46B3-A32A-03FF8DEB45AE</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>inputstring</key>
<string>{var:action}</string>
<key>matchcasesensitive</key>
<false/>
<key>matchmode</key>
<integer>2</integer>
<key>matchstring</key>
<string>\bexecute-terminal\b</string>
</dict>
<key>type</key>
<string>alfred.workflow.utility.filter</string>
<key>uid</key>
<string>76C5B220-7C6A-45F7-AFD9-12AA7EDFD839</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string></string>
Expand All @@ -360,6 +417,13 @@
<key>ypos</key>
<integer>460</integer>
</dict>
<key>76C5B220-7C6A-45F7-AFD9-12AA7EDFD839</key>
<dict>
<key>xpos</key>
<integer>420</integer>
<key>ypos</key>
<integer>590</integer>
</dict>
<key>7A0B639E-7E89-4443-8D59-6E486E864315</key>
<dict>
<key>xpos</key>
Expand Down Expand Up @@ -409,6 +473,13 @@
<key>ypos</key>
<integer>320</integer>
</dict>
<key>F51858AD-13C1-46B3-A32A-03FF8DEB45AE</key>
<dict>
<key>xpos</key>
<integer>520</integer>
<key>ypos</key>
<integer>560</integer>
</dict>
</dict>
<key>variables</key>
<dict>
Expand Down

0 comments on commit 5ff9e87

Please sign in to comment.