Put the celery seed, rosemary, peppercorns, and bay leaf in a spice grinder and grind. Add the spices, onion and garlic into a gallon sized freezer bag with the buttermilk, salt and sugar. Seal the bag and shake to combine. Add the chicken legs and seal the bag, pushing out as much air as possible, so the chicken is submerged in the buttermilk. Refrigerate overnight.
In a gallon sized freezer bag, combine the flour, onion powder, paprika, celery seed and black pepper and shake to combine. Remove the chicken from the buttermilk brine and use paper towels to dry off the chicken and remove any extra bits of spices. Add the dried chicken into the freezer bag with the flour one at a time and toss to coat. Shake any excess flour off as you transfer the chicken to a wire rack.
Strain the buttermilk brine through a sieve to remove the spices. Dip the chicken in the buttermilk mixture then put each piece back in the bag with the flour and apply a second thicker coating of flour. Place the chicken on the rack and let it air dry for at least 1 hour.
In a large heavy bottomed pot, add the oil. The oil should be at least 2" deep. Heat over medium high heat until it reaches 340 degrees F. Carefully add the chicken to the hot oil. The temperature will fall a bit, and you want to keep the oil right around 320 degrees F for the duration of they frying, so adjust the heat source as needed. The chicken will take about 12-15 minutes to cook through and should be golden brown on the outside. You can use a meat thermometer to check and see if the chicken is cooked on the inside, but take the chicken out of the oil once before checking, or the juices coming out of the chicken will make the oil splatter.
As the chicken is done, remove them from the oil and drain on a paper towel lined wire rack. Let the fried chicken rest for a few minutes and serve.