Cat Treats – With Pumpkin!

We grew pumpkins last year, and I wanted to make something for the cats too

 

8 oz cooked tuna
1 egg
1 oz shredded carrot
1 oz cooked pumpkin, mashed
1 oz olive oil
1 pinch catnip
7 oz oat flour

Preheat the oven to 350F

Mix everything except the oat flour together, the slowly stir in the flour to form a dough.

Spread on baking tray about 1/2″ thick & cook for 10-15 minutes. Cut into small rectangles and allow to cool. Serve to happy kittens!

Orchard Progress

Leaves are sprouting on almost all of the trees and bushes! There are two blueberries that might need to be replaced. And one honey berry that I am pretty sure has a leaf sprouting.

But the orchard is getting full — 2 pawpaws, 3 pears, 6 apples (although one still needs to be moved), 3 cherries, 2 peaches, and 1 fig. The third peach needs to be planted after the fig is moved. And I should have a second fig ready to plant this spring from a cutting I took last year. Two currants — the two replacements won’t get here until the end of May! Three honey berries, three seaberries (plus one more to plant this year), three gooseberries, seven raspberries, and ten blueberries (well, somewhere between eight and ten … we’ll know in another week or two!)

Low Effort Duck Confit

Although this takes a long time to cook, it’s very low effort and delicious.

Pat duck legs dry. Score the skin and salt liberally. Let rest for about an hour.

Put duck legs, skin side up, into a small casserole dish — you don’t want too much space because the fat renders out and fills the dish. Place in an oven and heat to 285F. Cook for about two hours. The duck should be partially submerged in the oil.

When the duck is tender, raise heat to 375F and cook for about 15 minutes to crisp the skin.

Let rest for about 15 mins and serve.

Eclipse

We watched the eclipse — it was surprising how much energy the sun puts off when the moon is mostly covering it!

But we had the totality for just under four minutes, and it was dark … and “sunrise” was everywhere.

Pita

To go with the smoked lamb, I made pita and tzatziki sauce. The pita was a basic dough recipe (although fairly wet dough!)

2 1/2 tsp active dry yeast
1 2/3 cups warm water about 95 degrees F
1 tsp maple syrup
1 1/4 tsp kosher salt
4 cups unbleached all purpose flour

Maple and water were mixed together & yeast added. The mixture sat on the counter for about twenty minutes and was really frothy. Salt and flour combined in the mixer, then the liquid added and dough kneaded for about ten minutes. Left to rise for about an hour, then split into eight balls, rolled out, and baked at 500F until puffed (4-5 minutes).

Smoked Leg of Lamb

Seasoned an approx 5 pound boneless leg of lamb with salt and pepper — also added about half a dozen cloves of garlic wrapped inside.

Smoked for about six hours with cherry wood

Then wrapped and cooked until the internal temperature was about 200F

ElasticSearch to OpenSearch Migration: Creating Tenants

Finally, create the tenants … we’re using OAUTH for Kibana authentication, so I wasn’t able to use the API to export “saved objects”. Fortunately, we don’t have many tenants … and exporting/importing those saved objects manually isn’t an onerous task.

import requests
from requests.auth import HTTPBasicAuth

def createTenant(strTenantName, strDescription):
        jsonAddTenant = {  "description": strDescription }
        r2 = requests.put(f"https://opensearch.example.com:9200/_opendistro/_security/api/tenants/{strTenantName}", json=jsonAddTenant, auth = HTTPBasicAuth('something', 'something'), verify=False)
        print(r2.text)
        print(r2.status_code)

#  Get all tenants from ES
r = requests.get(f"https://elasticsearch.example.com:9200/_opendistro/_security/api/tenants", auth = HTTPBasicAuth('something', 'something'), verify=False)

dictAllTenants = r.json()

for item in dictAllTenants.items():
        if item[1].get('reserved') == False:
                createTenant(item[0], item[1].get('description'))

ElasticSearch to OpenSearch Migration: Lifecycle Management Policies

Since there are a lot of changes in how lifecycle policies work between ElasticSearch and OpenSearch, the recommendation I’ve seen is to manually create them … but it’s a lot of repetitive typing, so I used a script to create a base policy — a name with a a hot allocation — and manually added all of the remaining stages, transitions, and index patterns to which the policy should be applied.

import requests
from requests.auth import HTTPBasicAuth
import json
from time import sleep
from datetime import timedelta

f = open("data-LifecyclePolicies.txt", "w")

listIgnoredILMPolicies = ["watch-history-ilm-policy"]

# Get all roles from prod & list users in those roles
r = requests.get(f"https://elasticsearch.example.com:9200/_ilm/policy", auth = HTTPBasicAuth('something', 'something'), verify=False)

dictAllILMPolicies= r.json()

for item in dictAllILMPolicies.items():
        if item[0] not in listIgnoredILMPolicies:
                strILMPolicyName = item[0]
                dictILMPolicySettings = item[1]
                iHotDays = None
                iWarmDays = None
                iColdDays = None
                iDeleteDays = None
                if item[1].get('policy').get('phases').get('hot'):
                        iHotDays = (item[1].get('policy').get('phases').get('hot').get('min_age'))
                if item[1].get('policy').get('phases').get('warm'):
                        iWarmDays = (item[1].get('policy').get('phases').get('warm').get('min_age'))
                if item[1].get('policy').get('phases').get('cold'):
                        iColdDays = (item[1].get('policy').get('phases').get('cold').get('min_age'))
                if item[1].get('policy').get('phases').get('delete'):
                        iDeleteDays = (item[1].get('policy').get('phases').get('delete').get('min_age'))
                print(f"Policy named {strILMPolicyName} has phases:")
                print(f"\tHot {iHotDays}")
                print(f"\tWarm {iWarmDays}")
                print(f"\tCold {iColdDays}")
                print(f"\tDelete {iDeleteDays}")
                print("\n")

                f.write(f"Policy named {strILMPolicyName} has phases:\n")
                f.write(f"\tHot {iHotDays}\n")
                f.write(f"\tWarm {iWarmDays}\n")
                f.write(f"\tCold {iColdDays}\n")
                f.write(f"\tDelete {iDeleteDays}\n")
                f.write("\n")
                jsonILMPolicyCreation = {
                                  "policy": {
                                    "description": "Ported from ES7",
                                    "default_state": "hot",
                                    "states": [
                                      {
                                        "name": "hot",
                                        "actions": [
                                          {
                                            "retry": {
                                              "count": 3,
                                              "backoff": "exponential",
                                              "delay": "1m"
                                            },
                                            "allocation": {
                                              "require": {
                                                "temp": "hot"
                                              },
                                              "include": {},
                                              "exclude": {},
                                              "wait_for": "false"
                                            }
                                          }
                                        ],
                                        "transitions": []
                                      }
                                    ],
                                    "ism_template": []
                                  }
                                }

                r2 = requests.put(f"https://opensearch:9200/_plugins/_ism/policies/{item[0]}", json=jsonILMPolicyCreation, auth = HTTPBasicAuth('something', 'something'), verify=False)
                print(r2.text)
                print(r2.status_code)
f.close()

ElasticSearch to OpenSearch Migration: Map Users to Roles

After the roles are created, I need to map users into the roles — using the ElasticSearch API to list all roles and add each user to the corresponding OpenSearch role.

import requests
from requests.auth import HTTPBasicAuth

def addUserToRole(strRole, strUID):
        jsonAddUser = [
        {               "op": "add",            "path": f"/{strRole}",          "value": {"users": strUID} }]
        print(f"{strRole}\t{jsonAddUser}")
        r2 = requests.patch(f"https://opensearch.example.com:9200/_plugins/_security/api/rolesmapping", json=jsonAddUser, auth = HTTPBasicAuth('something', 'something'), verify=False)
        print(r2.text)
        print(r2.status_code)

listIgnoredGroups = ['security_rest_api_access', 'logstash_role', 'elastalert_role', 'kibana_server', 'wsadmin_role', 'mgmt_role', 'logstash', 'manage_snapshots', 'readall', 'all_access', 'own_index', 'kibana_user', ]

# Get all roles from prod & list users in those roles
#GET _opendistro/_security/api/rolesmapping/
r = requests.get(f"https://elasticsearch.example.com:9200/_opendistro/_security/api/rolesmapping/", auth = HTTPBasicAuth('something', 'something'), verify=False)

dictAllRoles = r.json()

# For each role, list out each user and add that user to that role in OS
for item in dictAllRoles.items():
        if item[0] not in listIgnoredGroups:
                for strUID in item[1].get('users'):
                        addUserToRole(item[0], item[1].get('users'))